Skip to content

Commit 5d1b7c3

Browse files
committed
Handle eachrsplit change
1 parent 03d8782 commit 5d1b7c3

3 files changed

Lines changed: 11 additions & 6 deletions

File tree

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
matrix:
1212
version:
1313
- '1.6'
14-
- '1.7'
14+
- '1.9'
1515
- 'nightly'
1616
os:
1717
- ubuntu-latest

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ authors = ["ScottPJones <scottjones@alum.mit.edu>"]
44
keywords = ["Strings"]
55
license = "MIT"
66
uuid = "e79e7a6a-7bb1-5a4d-9d64-da657b06f53a"
7-
version = "1.1.4"
7+
version = "1.1.5"
88

99
[deps]
1010
Unicode = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"

src/util.jl

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#=
22
Utility functions for Str strings
33
4-
Copyright 2018-2021 Gandalf Software, Inc., Scott P. Jones,
4+
Copyright 2018-2023 Gandalf Software, Inc., Scott P. Jones,
55
and other contributors to the Julia language
66
Licensed under MIT License, see LICENSE.md
77
Based initially on julia/test/strings/util.jl
@@ -131,16 +131,21 @@ split(str::_SplitTypes, splitter::SetOfChars;
131131
limit::Integer=0, keepempty::Bool=true, keep::Union{Nothing,Bool}=nothing) =
132132
__split(str, in(splitter), limit, checkkeep(keepempty, keep, :split), splitarr(str))
133133

134+
@static if isdefined(Base, :eachrsplit)
135+
const _RSplitTypes = MaybeSub{<:Str{<:Union{_LatinCSE,_UCS2CSE,_UTF32CSE}}}
136+
else
137+
const _RSplitTypes = MaybeSub{<:Str}
134138
Base._rsplit(str::MaybeSub{<:Str}, splitter, limit, keepempty, vec) =
135139
__rsplit(str, splitter, limit, keepempty, vec)
140+
end
136141

137-
rsplit(str::MaybeSub{<:Str}, splitter;
142+
rsplit(str::_RSplitTypes, splitter;
138143
limit::Integer=0, keepempty::Bool=true, keep::Union{Nothing,Bool}=nothing) =
139144
__rsplit(str, splitter, limit, checkkeep(keepempty, keep, :rsplit), splitarr(str))
140-
rsplit(str::MaybeSub{<:Str}, splitter::AbstractChar;
145+
rsplit(str::_RSplitTypes, splitter::AbstractChar;
141146
limit::Integer=0, keepempty::Bool=true, keep::Union{Nothing,Bool}=nothing) =
142147
__rsplit(str, isequal(splitter), limit, checkkeep(keepempty, keep, :rsplit), splitarr(str))
143-
rsplit(str::MaybeSub{<:Str}, splitter::SetOfChars;
148+
rsplit(str::_RSplitTypes, splitter::SetOfChars;
144149
limit::Integer=0, keepempty::Bool=true, keep::Union{Nothing,Bool}=nothing) =
145150
__rsplit(str, in(splitter), limit, checkkeep(keepempty, keep, :rsplit), splitarr(str))
146151

0 commit comments

Comments
 (0)