summaryrefslogtreecommitdiff
path: root/lib/ur/string.ur
blob: e6d5903e3616b704acd99094be3ad00687fd7cbd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
type t = Basis.string

val length = Basis.strlen
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})