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 findlast and findprev examples to strings.md manual #29019

Merged
merged 2 commits into from
Oct 10, 2018
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
18 changes: 11 additions & 7 deletions doc/src/manual/strings.md
Original file line number Diff line number Diff line change
Expand Up @@ -617,20 +617,21 @@ julia> "1 + 2 = 3" == "1 + 2 = $(1 + 2)"
true
```

You can search for the index of a particular character using the [`findfirst`](@ref) function:
You can search for the index of a particular character using the
[`findfirst`](@ref) and [`findlast`](@ref) functions:

```jldoctest
julia> findfirst(isequal('x'), "xylophone")
1
julia> findfirst(isequal('o'), "xylophone")
4

julia> findfirst(isequal('p'), "xylophone")
5
julia> findlast(isequal('o'), "xylophone")
7

julia> findfirst(isequal('z'), "xylophone")
```

You can start the search for a character at a given offset by using [`findnext`](@ref)
with a third argument:
You can start the search for a character at a given offset by using
[`findnext`](@ref) and [`findprev`](@ref) with a three arguments:
Copy link
Member

Choose a reason for hiding this comment

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

"a three"

Maybe just remove the mention of the number of arguments, that's clear just by looking at the examples.


```jldoctest
julia> findnext(isequal('o'), "xylophone", 1)
Expand All @@ -639,6 +640,9 @@ julia> findnext(isequal('o'), "xylophone", 1)
julia> findnext(isequal('o'), "xylophone", 5)
7

julia> findprev(isequal('o'), "xylophone", 5)
4

julia> findnext(isequal('o'), "xylophone", 8)
```

Expand Down