@@ -109,56 +109,8 @@ function unsafe_convert(::Type{Ptr{R}}, s::SubString{String}) where R<:Union{Int
109
109
convert (Ptr{R}, pointer (s. string)) + s. offset
110
110
end
111
111
112
- # # reverse an index i so that reverse(s)[i] == s[reverseind(s,i)]
113
-
114
- """
115
- reverseind(v, i)
116
-
117
- Given an index `i` in [`reverse(v)`](@ref), return the corresponding index in `v` so that
118
- `v[reverseind(v,i)] == reverse(v)[i]`. (This can be nontrivial in cases where `v` contains
119
- non-ASCII characters.)
120
-
121
- # Examples
122
- ```jldoctest
123
- julia> r = reverse("Julia")
124
- "ailuJ"
125
-
126
- julia> for i in 1:length(r)
127
- print(r[reverseind("Julia", i)])
128
- end
129
- Julia
130
- ```
131
- """
132
- reverseind (s:: AbstractString , i) = chr2ind (s, length (s) + 1 - ind2chr (reverse (s), i))
133
112
reverseind (s:: SubString{String} , i:: Integer ) =
134
113
reverseind (s. string, nextind (s. string, endof (s. string))- s. offset- s. endof+ i- 1 ) - s. offset
135
114
136
- """
137
- repeat(s::AbstractString, r::Integer)
138
-
139
- Repeat a string `r` times. This can equivalently be accomplished by calling [`s^r`](@ref ^).
140
-
141
- # Examples
142
- ```jldoctest
143
- julia> repeat("ha", 3)
144
- "hahaha"
145
- ```
146
- """
147
- repeat (s:: AbstractString , r:: Integer ) = repeat (convert (String, s), r)
148
-
149
- """
150
- ^(s::Union{AbstractString,Char}, n::Integer)
151
-
152
- Repeat a string or character `n` times.
153
- The [`repeat`](@ref) function is an alias to this operator.
154
-
155
- # Examples
156
- ```jldoctest
157
- julia> "Test "^3
158
- "Test Test Test "
159
- ```
160
- """
161
- (^ )(s:: Union{AbstractString,Char} , r:: Integer ) = repeat (s,r)
162
-
163
115
pointer (x:: SubString{String} ) = pointer (x. string) + x. offset
164
116
pointer (x:: SubString{String} , i:: Integer ) = pointer (x. string) + x. offset + (i- 1 )
0 commit comments