o.k so I am trying to remove a comma from the string "110,000"
to leave me with the string "110000" that I can the convert to number like this :
I know that I could use the built in g.sub() function like this :
But that gives me the count of how many commas are removed at the end of the ouput which I don't want in the variable, also I need my code to be abloe to convert millions and billions aswell so what I'm looking for would be something that can convert like this :
Thanks.
to leave me with the string "110000" that I can the convert to number like this :
-- a is a variable with value "110,000" and is variable type "string"
a = "110,000"
-- the what I need to know here
-- then convert the new value of a that should now be "110000" as a variable that is type "string" to a variable that is type "number"
a = tonumber(a)
I know that I could use the built in g.sub() function like this :
print(string.gsub("110,000", ",", ""))
But that gives me the count of how many commas are removed at the end of the ouput which I don't want in the variable, also I need my code to be abloe to convert millions and billions aswell so what I'm looking for would be something that can convert like this :
100,000 to 100000
1,000,000 to 1000000
1,000,000,000 to 1000000000
Thanks.