Skip to content

Instantly share code, notes, and snippets.

@marktriggs
Created December 11, 2009 08:57
Show Gist options
  • Save marktriggs/254083 to your computer and use it in GitHub Desktop.
Save marktriggs/254083 to your computer and use it in GitHub Desktop.
(defn dumb-split [#^String s c #^"[Ljava.lang.String;" tokens]
(loop [i (int 0)
start (int 0)
end (int 0)]
(cond (>= end (.length s))
(do (aset tokens i (.substring s start end))
tokens)
(= (.charAt s end) c)
(do (aset tokens i (.substring s start end))
(recur (inc i) (inc end) (inc end)))
:else (recur i start (inc end)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment