-
-
Notifications
You must be signed in to change notification settings - Fork 91
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::takeLeft and String::takeRight #3159
Comments
I assume we need a |
They're not exact analogies. With Lists, it's implicit that you're taking from the front. Strings don't have a "front" because that depends on whether you read RTL (right-to-left) or LTR (with some languages being RTL), which is why we suggested takeLeft and takeRight for strings. For Lists, it wouldn't be terrible to rename to "takeFront" and "takeBack" I think. |
It took me quite a long time to realize this, but there's already a Is this Issue still valid? |
Apologies, this is harder than I expected. Good point. This made me reread the original naming discussion (#2188) and I realized I misunderstood the left/right thing. Because left and right are rendering properties, we actually don't want to use "left" and "right" but we actually want to use "start/end" or "first/last" or "front/back" etc. I think including "take" in the name is probably a good idea, and so is consistency. So then the issue is that we sometimes use start/end, and sometimes first/last. Meanwhile lists use first/last, or nothing, or in one case "back" ( I think we could probably use "start/end" consistently across both Lists and Strings? WDYT? |
First I tried getting some samples in different languages. The JS, F# and C# where manual, then I relied on gpt4, and checked afterward. It seems that there isn't a good standard, even in the same language. The only concern I have with
|
Thanks for doing this! I guess it's For RTL, it should work fine, as the RTL is just rendering, and "start" and "end" refer to the same place in both. |
Folding this issue into #5239, referenced there, to revisit later |
Check naming matches list functions
The text was updated successfully, but these errors were encountered: