-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Open
Labels
collectionsData structures holding multiple items, e.g. setsData structures holding multiple items, e.g. setsdesignDesign of APIs or of the language itselfDesign of APIs or of the language itselfstrings"Strings!""Strings!"
Description
Hello,
I would like to suggest a feature request, which I'm now working on in a new branch, for the split(str, splitter; limit=0, keep=true) function.
I found myself trying to use the function in that way, and what I expect somehow is the following,
julia> split("abcabcdabbcd", "b"; keep_splitter = true)
3-element Array{SubString{String},1}:
"a"
"bca"
"bcda"
"b"
"bcd"Should I keep on working? Would it be a breaking change for the rest of the ecosystem?
Some ideas:
- If the
keep_spliterflag istrue, then it should not make any difference whetherkeep(which stands for empty results), istrueorfalse, since, there wouldn't be empty results at all. - I'm not sure whether to include some other flag to include the splitter just to the next substring or to the previous one. This is how
readlines(file)work, isn't it? In each element of the array we have'\n'at the end.
julia> split("abcabcdabbcd", "b"; keep_splitter = true, prepend = false)
3-element Array{SubString{String},1}:
"ab"
"cab"
"cdab"
"b"
"cd"Thanks in advance!
PS, maybe it can be done with another function I don't know yet
briochemc, lisovyk and Socob
Metadata
Metadata
Assignees
Labels
collectionsData structures holding multiple items, e.g. setsData structures holding multiple items, e.g. setsdesignDesign of APIs or of the language itselfDesign of APIs or of the language itselfstrings"Strings!""Strings!"