Skip to content

Commit 1693b04

Browse files
committed
Rename strings/types.jl to strings/substring.jl
Move the non-substring related functionality to strings/basic.jl.
1 parent 0e7b347 commit 1693b04

File tree

2 files changed

+1
-49
lines changed

2 files changed

+1
-49
lines changed

base/strings/strings.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# This file is a part of Julia. License is MIT: https://julialang.org/license
22

33
include("strings/errors.jl")
4-
include("strings/types.jl")
4+
include("strings/substring.jl")
55
include("strings/basic.jl")
66
include("strings/search.jl")
77
include("strings/util.jl")

base/strings/types.jl renamed to base/strings/substring.jl

-48
Original file line numberDiff line numberDiff line change
@@ -109,56 +109,8 @@ function unsafe_convert(::Type{Ptr{R}}, s::SubString{String}) where R<:Union{Int
109109
convert(Ptr{R}, pointer(s.string)) + s.offset
110110
end
111111

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))
133112
reverseind(s::SubString{String}, i::Integer) =
134113
reverseind(s.string, nextind(s.string, endof(s.string))-s.offset-s.endof+i-1) - s.offset
135114

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-
163115
pointer(x::SubString{String}) = pointer(x.string) + x.offset
164116
pointer(x::SubString{String}, i::Integer) = pointer(x.string) + x.offset + (i-1)

0 commit comments

Comments
 (0)