mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
string: update split() method
This commit is contained in:
committed by
Alexander Medvednikov
parent
d1e7a54f3a
commit
b9728c7af0
@@ -310,8 +310,14 @@ fn (s string) add(a string) string {
|
||||
pub fn (s string) split(delim string) []string {
|
||||
// println('string split delim="$delim" s="$s"')
|
||||
mut res := []string
|
||||
// if delim.len == 0 {
|
||||
// res << s
|
||||
// return res
|
||||
// }
|
||||
if delim.len == 0 {
|
||||
res << s
|
||||
for ch in s {
|
||||
res << ch.str()
|
||||
}
|
||||
return res
|
||||
}
|
||||
if delim.len == 1 {
|
||||
|
||||
Reference in New Issue
Block a user