diff options
Diffstat (limited to 'lib/ur/string.ur')
-rw-r--r-- | lib/ur/string.ur | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/ur/string.ur b/lib/ur/string.ur index 23670966..e6d5903e 100644 --- a/lib/ur/string.ur +++ b/lib/ur/string.ur @@ -5,3 +5,14 @@ val append = Basis.strcat val sub = Basis.strsub val suffix = Basis.strsuffix + +val index = Basis.strindex +val atFirst = Basis.strchr + +fun substring s {Start = start, Len = len} = Basis.substring s start len + +fun split s ch = + case index s ch of + None => None + | Some i => Some (substring s {Start = 0, Len = i}, + substring s {Start = i + 1, Len = length s - i - 1}) |