GDScript: alphabet test

Hello
I would like to know how to do an alphabet test (isalpha in python)

thank you for your reply


Tags :

Answers

  • bitwesbitwes Posts: 60Member
    Answer ✓

    You could use the String class' to_ascii method. It gives you an array of ascii values for a string.

    print("asdf".to_ascii()[0])

    will print 97

    Using this you can check the value for each character against a range of numbers . 65-90 for capital letters and 97-122 for lower case. There's also some regex thing you could do.

  • bitwesbitwes Posts: 60Member
    Answer ✓

    Yep, there's a RegEx class in there. If you haven't regexed before...welcome to a very powerful new Hell.

  • gibdemayennegibdemayenne Posts: 5Member

    To_ascii () work very well, great thank you.
    I will see RegEx class it can be used one day

Sign In or Register to comment.