-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
[stdlib] Complete the string literals signature to match the String
one
#3438
base: nightly
Are you sure you want to change the base?
Conversation
Signed-off-by: Manuel Saelices <[email protected]>
Signed-off-by: Manuel Saelices <[email protected]>
strip()
, lstrip()
, and rstrip()
for string literalsstrip()
, lstrip()
, and rstrip()
, isdigit()
for string literals
Signed-off-by: Manuel Saelices <[email protected]>
strip()
, lstrip()
, and rstrip()
, isdigit()
for string literalsstrip()
, lstrip()
, and rstrip()
, isdigit()
, isupper()
and islower()
for string literals
strip()
, lstrip()
, and rstrip()
, isdigit()
, isupper()
and islower()
for string literalsstrip()
, lstrip()
, and rstrip()
, isdigit()
, isupper()
, __iter__()
and islower()
for string literals
Signed-off-by: Manuel Saelices <[email protected]>
Signed-off-by: Manuel Saelices <[email protected]>
strip()
, lstrip()
, and rstrip()
, isdigit()
, isupper()
, __iter__()
and islower()
for string literalsString
one
Signed-off-by: Manuel Saelices <[email protected]>
Signed-off-by: Manuel Saelices <[email protected]>
Signed-off-by: Manuel Saelices <[email protected]>
Signed-off-by: Manuel Saelices <[email protected]>
Signed-off-by: Manuel Saelices <[email protected]>
Signed-off-by: Manuel Saelices <[email protected]>
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.
!sync
!sync |
✅🟣 This contribution has been merged 🟣✅ Your pull request has been merged to the internal upstream Mojo sources. It will be reflected here in the Mojo repository on the nightly branch during the next Mojo nightly release, typically within the next 24-48 hours. We use Copybara to merge external contributions, click here to learn more. |
To match the existing methods in both Mojo and Python strings.
This could help bit a little with the transition of Python programmers playing with the REPL and small mojo examples that handle strings, finding it more familiar with Python
E.g. it's annoying for them to start playing with Mojo with a file like this one:
And encounter an error like this one:
New methods and features implemented in String literals
.strip()
,.lstrip()
, and.rstrip()
.isdigit()
.islower()
and.isupper()
.__iter__()
.startswith()
and.endswith()
.rjust()
,.ljust()
and.center()
.count()
.split()
and.splitlines()
Example