Skip to content

Commit

Permalink
Add findlast and findprev examples to strings.md manual (#29019)
Browse files Browse the repository at this point in the history
  • Loading branch information
royalbhati authored and fredrikekre committed Oct 10, 2018
1 parent 367aab3 commit e20d1ee
Showing 1 changed file with 11 additions and 7 deletions.
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
the functions [`findnext`](@ref) and [`findprev`](@ref):

```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

2 comments on commit e20d1ee

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

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

Executing the daily benchmark build, I will reply here when finished:

@nanosoldier runbenchmarks(ALL, isdaily = true)

@nanosoldier
Copy link
Collaborator

Choose a reason for hiding this comment

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

Your benchmark job has completed - possible performance regressions were detected. A full report can be found here. cc @ararslan

Please sign in to comment.