How to limit text?

How do i limit the text entry so that only 3 characters is allowed for the entry?

I guess you have a TextEntry object, and copy its text into a Text object to display it, this way:

Do = TextEntry.String() to the text of Text

To show the first 3 characters captured by the TextEntry, use this expression instead:

Do = SubStr(TextEntry.String(),0,3) to the text of Text

SubStr(TextEntry.String(),0,3) return the string in TextEntry from the position 0 (first letter) and 3 characters length :slight_smile:

:exclamation: The TextEntry will still have the entire string in memory, you can modify it too with the same expression.

Also, there is a very interesting feature request related: [url]Limit what characters can be captured by text entry object]

4 Likes

Thanks Lizard!

can you tell me where can i find the whole list of expressions which are not shown in the gd wiki
like the one you used here “Substr” and others like “Ceil”, “trunc” etc.
i Wanna know all

Here

http://wiki.compilgames.net/doku.php/gdevelop5/all-features/functions#function_references