Hello there, For my matchmaking system I’d like to know how to detect how many characters are in a text for example:
Hello
That will be a text with 5 characters in it and I’d like to know how to detect how much characters there is.
Any help is appreciated, Thanks!
2 Likes
Length operator #
local text = "Karozza" --7 characters
print(#text) -- Prints 7
Not sure if that’s what you wanted
So if I were to do:
local TextBoxText = TextBox.Text
if #TextBoxText == 20 then
print("20 characters")
end
It would detect 20 characters?, I never knew you could use the Length operator on a string
That would be correct if there are 20 characters in the text provided. If there are less or more than 20 it will not print
Remember that spaces count as well
local text = "Karozza And Yes"
print(#text) -- Prints 15
1 Like
Slappy_326
(Slappy_326)
#5
oh lol i didnt even know that this was possible, i always used string.len(text). thanks for sharing!
2 Likes