Well to get the length of the text. So heres how to do it. I think ofc.
local text = 'Red Alert!'
local Words = string.split(text, ' ')
local TextLength = ''
for _, word in pairs(Words) do
TextLength = TextLength..word
end
print(TextLength)
print('The finished number result is:'..#TextLength)
Theres probably a better way to do this but, here it i!
Make a list of letters. Then loop through every character of a lowercase version of the string. If it exists in the letter list, count it. If not, ignore it and move on.
(this may not work in lua but it would work in JS)
EDIT: according to another poster, they pretty much have a code version of what I was thinking of. turns out I keep thinking you gotta reinvent the wheel, but you dont, look at how they can just use some percent!
I assume a hacky way would to make a new string and filter out the characters you don’t want with string.gsub(). For example, string.gsub(yourstring, " ", “”), that would replace all spaces.
Another way would be iterating through the whole string and skipping any characters you do not want, while keeping a running count of those you want. (Like oddcraft said)
You need to exclude any spaces or special characters from the count babes, here is how you would go about doing that:
local text = "Red Alert!"
local letterCount = 0
for i = 1, #text do
local char = text:sub(i, i)
if char:match("%a") then
letterCount = letterCount + 1
end
end
print(letterCount)
task.wait(letterCount)