Skip to content

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.
@alexrp alexrp merged commit bc3c50c into ziglang:master May 12, 2025
16 of 18 checks passed
@sorairolake sorairolake deleted the rename-trims branch May 12, 2025 18:24
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
3 participants