mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 15:18:49 +00:00
Fix strings.split_iterator when separator is empty
This commit is contained in:
@@ -1031,14 +1031,10 @@ 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) {
|
||||||
if sep == "" {
|
|
||||||
res = s[:]
|
|
||||||
ok = true
|
|
||||||
s^ = s[len(s):]
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
m := index(s^, sep)
|
m := index(s^, sep)
|
||||||
|
if sep == "" {
|
||||||
|
m = 1 if len(s) > 0 else -1
|
||||||
|
}
|
||||||
if m < 0 {
|
if m < 0 {
|
||||||
// not found
|
// not found
|
||||||
res = s[:]
|
res = s[:]
|
||||||
|
|||||||
Reference in New Issue
Block a user