From 27e0e0a69dfe6f0f5f415f8eea08d88f6e6c6245 Mon Sep 17 00:00:00 2001 From: Royal Bhati Date: Mon, 3 Sep 2018 19:51:59 +0530 Subject: [PATCH 1/2] Include examples for findlast, findprev in the manual section about strings. --- doc/src/manual/strings.md | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/doc/src/manual/strings.md b/doc/src/manual/strings.md index 304b3c2e3300d..88636a40f867e 100644 --- a/doc/src/manual/strings.md +++ b/doc/src/manual/strings.md @@ -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: ```jldoctest julia> findnext(isequal('o'), "xylophone", 1) @@ -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) ``` From e56ff9c043a861ef4ec41604cbb7967c090448fe Mon Sep 17 00:00:00 2001 From: Kristoffer Carlsson Date: Wed, 10 Oct 2018 09:09:17 -0400 Subject: [PATCH 2/2] update from review --- doc/src/manual/strings.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/src/manual/strings.md b/doc/src/manual/strings.md index 88636a40f867e..0b00898bbf73b 100644 --- a/doc/src/manual/strings.md +++ b/doc/src/manual/strings.md @@ -631,7 +631,7 @@ julia> findfirst(isequal('z'), "xylophone") ``` You can start the search for a character at a given offset by using -[`findnext`](@ref) and [`findprev`](@ref) with a three arguments: +the functions [`findnext`](@ref) and [`findprev`](@ref): ```jldoctest julia> findnext(isequal('o'), "xylophone", 1)