split.zy 354 B

12345678910111213141516171819202122
  1. (def testStr "this is my \n test str")
  2. // split on newline
  3. (assert (==
  4. "this is my " (first
  5. (split testStr "\n"))))
  6. // second index
  7. (assert (==
  8. " test str" (aget
  9. (split testStr "\n") 1)))
  10. // split on space
  11. (assert (==
  12. 6 (len
  13. (split testStr " "))))
  14. // don't split on char that doesn't exist
  15. (assert (==
  16. 1 (len
  17. (split testStr "."))))