@@ -16,7 +16,7 @@ about strings:
1616 * Each `AbstractChar` in a string is encoded by one or more code units
1717 * Only the index of the first code unit of an `AbstractChar` is a valid index
1818 * The encoding of an `AbstractChar` is independent of what precedes or follows it
19- * String encodings are [self-synchronizing] – i.e. `isvalid(s, i)` is O(1)
19+ * String encodings are [self-synchronizing] – i.e. `isvalid(s, i)` is O(1)
2020
2121[self-synchronizing]: https://en.wikipedia.org/wiki/Self-synchronizing_code
2222
@@ -46,8 +46,8 @@ AbstractString
4646 ncodeunits(s::AbstractString) -> Int
4747
4848Return the number of code units in a string. Indices that are in bounds to
49- access this string must satisfy `1 ≤ i ≤ ncodeunits(s)`. Not all such indices
50- are valid – they may not be the start of a character, but they will return a
49+ access this string must satisfy `1 ≤ i ≤ ncodeunits(s)`. Not all such indices
50+ are valid – they may not be the start of a character, but they will return a
5151code unit value when calling `codeunit(s,i)`.
5252
5353# Examples
@@ -389,7 +389,7 @@ length(s::AbstractString) = @inbounds return length(s, 1, ncodeunits(s)::Int)
389389function length (s:: AbstractString , i:: Int , j:: Int )
390390 @boundscheck begin
391391 0 < i ≤ ncodeunits (s):: Int + 1 || throw (BoundsError (s, i))
392- 0 ≤ j < ncodeunits (s):: Int + 1 || throw (BoundsError (s, j))
392+ 0 ≤ j < ncodeunits (s):: Int + 1 || throw (BoundsError (s, j))
393393 end
394394 n = 0
395395 for k = i: j
@@ -438,8 +438,8 @@ thisind(s::AbstractString, i::Integer) = thisind(s, Int(i))
438438function thisind (s:: AbstractString , i:: Int )
439439 z = ncodeunits (s):: Int + 1
440440 i == z && return i
441- @boundscheck 0 ≤ i ≤ z || throw (BoundsError (s, i))
442- @inbounds while 1 < i && ! (isvalid (s, i):: Bool )
441+ @boundscheck 0 ≤ i ≤ z || throw (BoundsError (s, i))
442+ @inbounds while 1 < i && ! (isvalid (s, i):: Bool )
443443 i -= 1
444444 end
445445 return i
@@ -498,7 +498,7 @@ function prevind(s::AbstractString, i::Int, n::Int)
498498 z = ncodeunits (s) + 1
499499 @boundscheck 0 < i ≤ z || throw (BoundsError (s, i))
500500 n == 0 && return thisind (s, i) == i ? i : string_index_err (s, i)
501- while n > 0 && 1 < i
501+ while n > 0 && 1 < i
502502 @inbounds n -= isvalid (s, i -= 1 )
503503 end
504504 return i - n
@@ -557,7 +557,7 @@ function nextind(s::AbstractString, i::Int, n::Int)
557557 z = ncodeunits (s)
558558 @boundscheck 0 ≤ i ≤ z || throw (BoundsError (s, i))
559559 n == 0 && return thisind (s, i) == i ? i : string_index_err (s, i)
560- while n > 0 && i < z
560+ while n > 0 && i < z
561561 @inbounds n -= isvalid (s, i += 1 )
562562 end
563563 return i + n
0 commit comments