Skip to content

Commit 3e06ccd

Browse files
committed
Rename strings/types.jl to strings/substring.jl
Move the non-substring related functionality to strings/basic.jl.
1 parent 7d244be commit 3e06ccd

File tree

2 files changed

+1
-49
lines changed

2 files changed

+1
-49
lines changed

base/strings/strings.jl

Lines changed: 1 addition & 1 deletion
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

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -98,57 +98,9 @@ function unsafe_convert(::Type{Ptr{R}}, s::SubString{String}) where R<:Union{Int
9898
convert(Ptr{R}, pointer(s.string)) + s.offset
9999
end
100100

101-
## reverse an index i so that reverse(s)[i] == s[reverseind(s,i)]
102-
103-
"""
104-
reverseind(v, i)
105-
106-
Given an index `i` in [`reverse(v)`](@ref), return the corresponding index in `v` so that
107-
`v[reverseind(v,i)] == reverse(v)[i]`. (This can be nontrivial in cases where `v` contains
108-
non-ASCII characters.)
109-
110-
# Examples
111-
```jldoctest
112-
julia> r = reverse("Julia")
113-
"ailuJ"
114-
115-
julia> for i in 1:length(r)
116-
print(r[reverseind("Julia", i)])
117-
end
118-
Julia
119-
```
120-
"""
121-
reverseind(s::AbstractString, i) = chr2ind(s, length(s) + 1 - ind2chr(reverse(s), i))
122101
reverseind(s::Union{DirectIndexString,SubString{DirectIndexString}}, i::Integer) = length(s) + 1 - i
123102
reverseind(s::SubString{String}, i::Integer) =
124103
reverseind(s.string, nextind(s.string, endof(s.string))-s.offset-s.endof+i-1) - s.offset
125104

126-
"""
127-
repeat(s::AbstractString, r::Integer)
128-
129-
Repeat a string `r` times. This can equivalently be accomplished by calling [`s^r`](@ref ^).
130-
131-
# Examples
132-
```jldoctest
133-
julia> repeat("ha", 3)
134-
"hahaha"
135-
```
136-
"""
137-
repeat(s::AbstractString, r::Integer) = repeat(convert(String, s), r)
138-
139-
"""
140-
^(s::Union{AbstractString,Char}, n::Integer)
141-
142-
Repeat a string or character `n` times.
143-
The [`repeat`](@ref) function is an alias to this operator.
144-
145-
# Examples
146-
```jldoctest
147-
julia> "Test "^3
148-
"Test Test Test "
149-
```
150-
"""
151-
(^)(s::Union{AbstractString,Char}, r::Integer) = repeat(s,r)
152-
153105
pointer(x::SubString{String}) = pointer(x.string) + x.offset
154106
pointer(x::SubString{String}, i::Integer) = pointer(x.string) + x.offset + (i-1)

0 commit comments

Comments
 (0)