Skip to content

Add string sub --end #5974

Description

@zx8

Would be neat if string sub --length accepted negatives indexes, just like string sub --start, e.g.

$ string sub --length -2 -- foobar
foob

AFAIK, the only way to achieve this at the moment is:

$ set s foobar
$ string sub --length (math (string length -- $s) - 2) -- $s
foob

(Also, feel like this option should be (re?)named --end to match --start)

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

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions