Skip to content

proposal: bytes, strings: TrimStart and TrimEnd replacing TrimLeft and TrimRight #54678

Description

@hajimehoshi

TrimLeft and TrimRight implicitly assumes a left-to-right writing system, but this is odd. Actually a string literal can include right-to-left languages and how to show them depends on editors. We don't have to (or cannot) determine visible directions of texts.

So, what about adding new functions TrimStart and TrimEnd as aliases to TrimLeft and TrimRight, and deprecating TrimLeft and TrimRight? This naming is the same way as CSS (e.g. padding-inline-start for padding-left)

The replacing targets are:

  • bytes.TrimLeft
  • bytes.TrimLeftFunc
  • bytes.TrimRight
  • bytes.TrimRightFunc
  • strings.TrimLeft
  • strings.TrimLeftFunc
  • strings.TrimRight
  • strings.TrimRightFunc

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions