Skip to content

Commit

Permalink
fixed doctest
Browse files Browse the repository at this point in the history
  • Loading branch information
cecoeco committed May 15, 2024
1 parent d9f7e76 commit e8ccd77
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions src/strings_docstrings.jl
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ julia> str_to_sentence("hello world!")
"Hello world!"
julia> str_to_sentence("a sentence mUst starT With A capital letter.")
"A sentence must start With a capital letter."
"A sentence must start with a capital letter."
```
"""

Expand Down Expand Up @@ -427,19 +427,19 @@ The extracted word from the string.
Examples
```jldoctest
julia> word("Jane saw a cat", 1)
1-element Vector{String}:
1-element Vector{SubString{String}}:
"Jane"
julia> word("Jane saw a cat", 2)
1-element Vector{String}:
1-element Vector{SubString{String}}:
"saw"
julia> word("Jane saw a cat", -1)
1-element Vector{String}:
1-element Vector{SubString{String}}:
"cat"
julia> word("Jane saw a cat", 2, -1)
3-element Vector{String}:
3-element Vector{SubString{String}}:
"saw"
"a"
"cat"
Expand All @@ -462,14 +462,13 @@ A vector of booleans indicating if the string starts with the pattern.
Examples
```jldoctest
julia> fruit = ["apple", "banana", "pear", "pineapple"]
julia> str_starts(fruit, r"^p") # [false, false, true, true]
julia> str_starts(["apple", "banana", "pear", "pineapple"], r"^p") # [false, false, true, true]
4-element Vector{Bool}:
false
false
true
true
julia> str_starts(fruit, r"^p", negate=true) # [true, true, false, false]
julia> str_starts(["apple", "banana", "pear", "pineapple"], r"^p", negate=true) # [true, true, false, false]
4-element Vector{Bool}:
true
true
Expand All @@ -494,14 +493,13 @@ A vector of booleans indicating if the string ends with the pattern.
Examples
```jldoctest
julia> fruit = ["apple", "banana", "pear", "pineapple"]
julia> str_ends(fruit, r"e\$") # [true, false, false, true]
julia> str_ends(["apple", "banana", "pear", "pineapple"], r"e\$") # [true, false, false, true]
4-element Vector{Bool}:
true
false
false
true
julia> str_ends(fruit, r"e\$", negate=true) # [false, true, true, false]
julia> str_ends(["apple", "banana", "pear", "pineapple"], r"e\$", negate=true) # [false, true, true, false]
4-element Vector{Bool}:
false
true
Expand All @@ -526,16 +524,15 @@ An integer vector containing indices of matching strings.
# Examples
```jldoctest
julia> fruit = ["apple", "banana", "pear", "pineapple"]
julia> str_which(fruit, r"a") # [1, 3]
julia> str_which(["apple", "banana", "pear", "pineapple"], r"a") # [1, 3]
2-element Vector{Int64}:
1
3
julia> str_which(fruit, r"a", negate=true) # [2, 4]
julia> str_which(["apple", "banana", "pear", "pineapple"], r"a", negate=true) # [2, 4]
2-element Vector{Int64}:
2
4
julia> str_which(fruit, "a", negate=true) # []
julia> str_which(["apple", "banana", "pear", "pineapple"], "a", negate=true) # []
0-element Vector{Int64}:
```
"""

0 comments on commit e8ccd77

Please sign in to comment.