mirror of
https://github.com/carp-lang/Carp.git
synced 2024-09-11 05:25:28 +03:00
fix: fix String.words for multiple spaces (#1205)
This commit is contained in:
parent
2afe09a94e
commit
77020df042
@ -144,7 +144,7 @@ list of those characters.")
|
||||
|
||||
(doc words "splits a string into words.")
|
||||
(defn words [s]
|
||||
(split-by s &[\tab \space \newline]))
|
||||
(Array.endo-filter &(fn [s] (not (empty? s))) (split-by s &[\tab \space \newline])))
|
||||
|
||||
(doc lines "splits a string into lines.")
|
||||
(defn lines [s]
|
||||
|
@ -184,7 +184,11 @@
|
||||
(assert-equal test
|
||||
&[@"erik" @"sved" @"hej" @"foo"]
|
||||
&(words "erik sved\nhej\tfoo")
|
||||
"words works correctly")
|
||||
"words works correctly I")
|
||||
(assert-equal test
|
||||
&[@"erik" @"sved" @"hej" @"foo"]
|
||||
&(words "erik sved\n\nhej\tfoo")
|
||||
"words works correctly II")
|
||||
(assert-equal test
|
||||
&[@"erik" @"sved" @"hej" @"foo"]
|
||||
&(lines "erik\nsved\nhej\nfoo")
|
||||
|
Loading…
Reference in New Issue
Block a user