[Solved] How to get the length of a string?

Hi, so i’ve been making a game using the text entry object and I was wondering if there was an expression to get how many letters there were in a string?

Have you take a look in the expression list ?
Click on the sigma blue button.

An search bar exist in this list.
If you need help about expressions you can click on the help button, see the red rectangles.



You should be able to use regular javascript expressions like .length

If you’re having trouble implementing it, happy to help you debug it if you share an image of your event.

There is an expression in GD for get the lenght of an text, and another one for get the text of an “Text Entry” object :wink:

:man_bowing: that’s the more GDevelop way of going about it, thanks!

1 Like

You can use the StrLength expression to get it :wink:

I also really like Js and using it in GDevelop but for most users it should be a last resort solution.

1 Like

Hey, sorry, i’ve already found the expression that I needed.

I was just a bit confused because for some reason I cant use “StrLength()” in the modify text action, but thanks anyways :grin:

StrLength() return a number.
Modify text action, use a string.
If you want use a number expression in a text/string expression you need convert it before.
There is a expression for convert an value in another one.

1 Like