-
-
Notifications
You must be signed in to change notification settings - Fork 22k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add String.is_valid_unicode_identifier()
#95984
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change makes sense to me. I've been wondering how to check for a valid Unicode identifier recently from a script, in fact 🙂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first line of the new method's description could be a bit more detailed to entail what a "valid Unicode identifier" means, at least roughly.
The examples could also be more distinct than is_valid_identifier
's, such as using accented letters and similar.
84a9990
to
ca3fd90
Compare
- Adds `is_valid_unicode_identifier()` - Adds `is_valid_ascii_identifier()` - Deprecates `is_valid_identifier()` - Renames `validate_identifier()` to `validate_ascii_identifier()`
ca3fd90
to
8bf4ecc
Compare
Thanks! |
Implements godotengine/godot-proposals#9851
Rationale:
is_valid_identifier()
is checking for traditional ASCII identifiers. Its name can be confusing because GDScript implements Unicode identifiers.TextServer.is_valid_identifier()
is close, but advanced text server adds extra conversions and rules. Text server extensions could potentially also change the rules.This PR:
is_valid_unicode_identifier()
: Basic unicode identifier checking, the same as how GDScript parses identifiersis_valid_ascii_identifier()
: Same as the oldis_valid_identifier()
is_valid_identifier()
validate_identifier()
tovalidate_ascii_identifier()