How to make a variable that changes "" to ' '

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    Making a variable for " " such as “I can do this” I can change it to ‘i can do this’

  2. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    I know variables so I thought I could do “” = ’ ’ but that gave me a error
    After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!

"" = ' '

Please do not ask people to write entire scripts or design entire systems for you. If you can’t answer the three questions above, you should probably pick a different category.

1 Like

Check out this string information.
string.lower changes uppercase to lowercase.
edit… sorry, I saw you wanted the 2 examples with uppercase and lowercase I/i.

It may help if you let others know why you want to do this so we can understand and help you better.

If you mean changing x = "hello" to x = 'hello' then there is no reason to do this. Both are string literals and represent the exact same thing. You would decide to use one vs the other if you need to include quotes in your string.

x = '"hello"' == x = "'hello'"

I’m assuming you want to change double quotes contained within a string to single quotes, in which case you can use gsub:

string.gsub('"I can do this"', '"', "'")

This takes the string, finds double quotes (second parameter) and replaces them with single quotes (third parameter).

1 Like

i didnt even know about this thanks

well if people use “” i wanted to make it a variable because Roblox might deprecate it

I doubt Roblox will ever deprecate " that would be really dumb

no sorry i meant ’ not " woops

1 Like

Roblox will never deprecate it. It’s built into lua and every other programming language. Just use one or the other depending on your preference/use case.

1 Like

In programming strings are stored as strings, when you type either “123” or ‘123’ into your script it is still going to be a string value. You can see this very clearly by running this code,

http = game:GetService("HttpService")
print(http:JSONEncode("123")) -- " " example
print(http:JSONEncode('123')) -- ' ' example

This shows an example of how the values are stored and how it does not make a diffrence if you use " " or ’ ’

The reason that you can define strings using " " or ’ ’ can be seen below

test1 = " ' " --Able to type in ' without doing \' which you would have to do using ' '
test1 = ' " ' --Able to type in " without doing \" which you would have to do using " "

To add, roblox will not deprecate these two methods of defining strings as it would break most games on roblox.

I hope this was useful.