mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
Merge pull request #4789 from jfcode4/master
[core/strings] Fix _split_iterator when separator is empty
This commit is contained in:
@@ -1031,14 +1031,17 @@ Returns:
|
|||||||
*/
|
*/
|
||||||
@private
|
@private
|
||||||
_split_iterator :: proc(s: ^string, sep: string, sep_save: int) -> (res: string, ok: bool) {
|
_split_iterator :: proc(s: ^string, sep: string, sep_save: int) -> (res: string, ok: bool) {
|
||||||
|
m: int
|
||||||
if sep == "" {
|
if sep == "" {
|
||||||
res = s[:]
|
if len(s) == 0 {
|
||||||
ok = true
|
m = -1
|
||||||
s^ = s[len(s):]
|
} else {
|
||||||
return
|
_, w := utf8.decode_rune_in_string(s^)
|
||||||
|
m = w
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
m = index(s^, sep)
|
||||||
}
|
}
|
||||||
|
|
||||||
m := index(s^, sep)
|
|
||||||
if m < 0 {
|
if m < 0 {
|
||||||
// not found
|
// not found
|
||||||
res = s[:]
|
res = s[:]
|
||||||
|
|||||||
Reference in New Issue
Block a user