mirror of
https://github.com/carp-lang/Carp.git
synced 2024-10-26 05:45:37 +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.")
|
(doc words "splits a string into words.")
|
||||||
(defn words [s]
|
(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.")
|
(doc lines "splits a string into lines.")
|
||||||
(defn lines [s]
|
(defn lines [s]
|
||||||
|
@ -184,7 +184,11 @@
|
|||||||
(assert-equal test
|
(assert-equal test
|
||||||
&[@"erik" @"sved" @"hej" @"foo"]
|
&[@"erik" @"sved" @"hej" @"foo"]
|
||||||
&(words "erik sved\nhej\tfoo")
|
&(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
|
(assert-equal test
|
||||||
&[@"erik" @"sved" @"hej" @"foo"]
|
&[@"erik" @"sved" @"hej" @"foo"]
|
||||||
&(lines "erik\nsved\nhej\nfoo")
|
&(lines "erik\nsved\nhej\nfoo")
|
||||||
|
Loading…
Reference in New Issue
Block a user