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

Make view of a string return a substring #35879

Merged
merged 7 commits into from
May 20, 2020

Conversation

oxinabox
Copy link
Contributor

@oxinabox oxinabox commented May 13, 2020

the docs say

Range indexing makes a copy of the selected part of the original string. Alternatively, it is possible to create a view into a string using the type SubString, …

(emph, mine)

but without this PR @view "abcd"[2:3] just MethodErrors

base/strings/substring.jl Outdated Show resolved Hide resolved
@ararslan ararslan requested a review from StefanKarpinski May 14, 2020 19:20
@ararslan ararslan added the strings "Strings!" label May 14, 2020
base/strings/substring.jl Outdated Show resolved Hide resolved
@oxinabox oxinabox force-pushed the ox/substringview branch from 7b89e86 to b3e1837 Compare May 16, 2020 16:23
test/strings/basic.jl Outdated Show resolved Hide resolved
@oxinabox
Copy link
Contributor Author

This should be good to go now

Copy link
Member

@StefanKarpinski StefanKarpinski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aside from the missing space, this looks good to me.

NEWS.md Outdated Show resolved Hide resolved
@StefanKarpinski StefanKarpinski merged commit 9655c21 into JuliaLang:master May 20, 2020
simeonschaub pushed a commit to simeonschaub/julia that referenced this pull request Aug 11, 2020
* make taking views of string indexing give substrings

* add news

* Remove excess whitespace

* handle single character string views correctly

* test values of views

* make substring etc work on AbstractUnitRanges

* Fix missing space
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
strings "Strings!"
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants