Implement match, find, split

This commit is contained in:
Flaviu Tamas 2015-01-12 20:09:19 -05:00
commit 2474758ed5
5 changed files with 145 additions and 8 deletions

9
test/split.nim Normal file
View file

@ -0,0 +1,9 @@
import unittest
include nre
suite "string splitting":
test "splitting strings":
check(initRegex("").split("12345") == @["1", "2", "3", "4", "5"])
check(initRegex(" ", "S").split("1 2 3 4 5 6 ") == @["1", "2", "3", "4", "5", "6", ""])
check(initRegex(" ", "S").split("1 2 ") == @["1", "", "2", "", ""])
check(initRegex(" ", "S").split("1 2") == @["1", "2"])