Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How do you find the sub of a character?

Asked by 5 years ago

Hello, I am trying to find the sub of a character from a string to solve math problems. For example:

local number = tonumber(numerator.Text)/tonumber(demonator.Text)
local nextNumber = number - ? -- Whole Number

As you can see, we need to find the whole number of the equation. To do this, we have to find the decimal point "." but we also need to know at what position that is. See, what I am trying to find is this:

local number = 50.3
local decimal_point = number:find(".")

But I need it to give me the number at which the decimal is placed. Which should go something like this:

local number = 50.3
if number:find(".") then
        print(found_position) -- Which would be 3
end

And then my plan is to use all this for converting improper fractions to mixed numbers. Thank you if you can help.

0
Just use the modulo operation, % for finding the remainder. hiimgoodpack 2009 — 5y

Answer this question