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

Add documentation of SubString #23957

Merged
merged 3 commits into from
Oct 3, 2017
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions doc/src/manual/strings.md
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,23 @@ Some other useful functions include:
`i`.
* [`chr2ind(str,j)`](@ref) gives the index at which the `j`th character in `str` occurs.


It is possible to create a view into a string using the type `SubString`, for example:

```jldoctest
julia> str = "long string"
"long string"

julia> substr = SubString(str, 1, 4)
"long"

julia> typeof(substr)
SubString{String}
```

`SubString` works like [`getindex`](@ref), but it does not make a copy of the parent string. Several
standard functions like [`chop`](@ref), [`chomp`](@ref) or [`strip`](@ref) return a `SubString`.

## [Non-Standard String Literals](@id non-standard-string-literals)

There are situations when you want to construct a string or use string semantics, but the behavior
Expand Down