Skip to content
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

Support chopprefix/chopsuffix returning InlineString #40

Closed
nickrobinson251 opened this issue Sep 30, 2022 · 0 comments · Fixed by #41
Closed

Support chopprefix/chopsuffix returning InlineString #40

nickrobinson251 opened this issue Sep 30, 2022 · 0 comments · Fixed by #41

Comments

@nickrobinson251
Copy link
Collaborator

In Julia v1.8 we now have chopprefix and chopsuffix

Because they're implemented in terms of iterate, they already work on InlineString types but they return a SubString whereas, like with chop/chomp, we could instead be returning an InlineString e.g.

julia> s = "hey_there_";

julia> si = InlineString(s);

julia> chopsuffix(s, "_")
"hey_there"

julia> chopsuffix(si, "_")  # correct answer, but...
"hey_there"

julia> typeof(ans)          # unexpected type (SubString)
SubString{String15}

julia> chop(si)             # for comparison...
"hey_there"

julia> typeof(ans)          # returns InlineString (not SubString)
String15

related: #5

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 a pull request may close this issue.

1 participant