1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-11 19:18:01 +00:00

Merge pull request #5 from sdegutis/patch-2

Update splitting-on-whitespace.md
This commit is contained in:
Josh Branchaud
2016-02-14 14:25:19 -06:00

View File

@@ -20,7 +20,7 @@ what you want:
A quick fix might look like this:
```clojure
(clojure.string/split "double spacing wtf?" #"[ ]+")
(clojure.string/split "double spacing wtf?" #" +")
; ["double" "spacing" "wtf?"]
```
@@ -29,6 +29,6 @@ tabs and new lines. Assuming we want to split on all whitespace, we should
tell our regular expression to do just that:
```clojure
(clojure.string/split "we\thave new\nlines and tabs\n" #"[\s]+")
(clojure.string/split "we\thave new\nlines and tabs\n" #"\s+")
; ["we" "have" "new" "lines" "and" "tabs"]
```