Skip to content

slice on strings an binary #4227

Closed
Closed

Description

@danielmewes

Follow up from #264 and a question on the mailing list.

The proposal is to make slice work on strings and binary data in addition to arrays.
On binary data it would operate on a byte level, and on string data it would operate on UTF-8 code points.

Scheduling for 2.2 since it has come up repeatedly.

Activity

  1. added this to the 2.2 milestone on May 13, 2015
  2. coffeemug commented on May 13, 2015

    @coffeemug
    Contributor

    slice already works on binary data.

    > r.http('https://2.gravatar.com/avatar/767fc9c115a1b989744c755db47feb60?s=132&d=wavatar')
       .slice(10, 20)
    <binary, 10 bytes, "00 01 01 00 00 01...">
  3. danielmewes commented on May 13, 2015

    @danielmewes
    MemberAuthor

    Oh I didn't realize that. Thanks @coffeemug .
    So that just leaves strings.

  4. mlucy commented on Aug 27, 2015

    @mlucy
    Member

    +1, defining slice on strings seems good.

  5. coffeemug commented on Aug 27, 2015

    @coffeemug
    Contributor

    👍

  6. VeXocide commented on Aug 27, 2015

    @VeXocide
    Member

    +1

  7. danielmewes commented on Sep 3, 2015

    @danielmewes
    MemberAuthor

    Marking as settled (extending slice to work on strings, where the indexes should be based on code points).

  8. modified the milestones: 2.2, 2.3 on Oct 5, 2015
  9. encryptio commented on Dec 14, 2015

    @encryptio
    Contributor

    In CR 3397 with @Tryneus

  10. encryptio commented on Dec 22, 2015

    @encryptio
    Contributor

    In next as of 85a9f88, will be in 2.3.

  11. added a commit that references this issue on Aug 7, 2026
    57383a9
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions