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

Update splitting-on-whitespace.md

This commit is contained in:
Steven Degutis
2016-02-09 17:49:45 -06:00
parent 9a9773e049
commit c03cad7a56

View File

@@ -20,7 +20,7 @@ what you want:
A quick fix might look like this: A quick fix might look like this:
```clojure ```clojure
(clojure.string/split "double spacing wtf?" #"[ ]+") (clojure.string/split "double spacing wtf?" #" +")
; ["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: tell our regular expression to do just that:
```clojure ```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"] ; ["we" "have" "new" "lines" "and" "tabs"]
``` ```