Skip to content

chore(std.mem): Rename trimLeft and trimRight to trimStart and trimEnd #23700

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

sorairolake
Copy link
Contributor

@sorairolake sorairolake commented Apr 27, 2025

Rename trimLeft to trimStart, and trimRight to trimEnd. trimLeft and trimRight functions remain as deprecated aliases for these new names.

Due to this change, these functions will do exactly what their names suggest in right-to-left scripts, just like in left-to-right scripts and non-string slices.

The new function names I suggested are inspired by JavaScript,12 C#,34 and Rust.56

Closes #23664

Footnotes

  1. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/trimStart

  2. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/trimEnd

  3. https://learn.microsoft.com/en-us/dotnet/api/system.string.trimstart

  4. https://learn.microsoft.com/en-us/dotnet/api/system.string.trimend

  5. https://doc.rust-lang.org/std/primitive.str.html#method.trim_start

  6. https://doc.rust-lang.org/std/primitive.str.html#method.trim_end

Rename `trimLeft` to `trimStart`, and `trimRight` to `trimEnd`.
`trimLeft` and `trimRight` functions remain as deprecated aliases for
these new names.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Proposal: Rename mem.trimLeft and mem.trimRight to mem.trimStart and mem.trimEnd
2 participants