Mercurial > urweb
comparison lib/ur/string.ur @ 1272:56bd4a4f6e66
Some serious bug-fix work to get HTML example to compile; this includes fixing a bug with 'val' patterns in Unnest and the need for more local reduction in Especialize
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Thu, 03 Jun 2010 13:04:37 -0400 |
parents | 9df124fcab3d |
children | f0afe61a6f8b |
comparison
equal
deleted
inserted
replaced
1271:503d4ec93494 | 1272:56bd4a4f6e66 |
---|---|
9 val suffix = Basis.strsuffix | 9 val suffix = Basis.strsuffix |
10 | 10 |
11 val index = Basis.strindex | 11 val index = Basis.strindex |
12 val atFirst = Basis.strchr | 12 val atFirst = Basis.strchr |
13 | 13 |
14 fun mindex {Haystack = s, Needle = chs} = Basis.strcspn s chs | 14 fun mindex {Haystack = s, Needle = chs} = |
15 let | |
16 val n = Basis.strcspn s chs | |
17 in | |
18 if n >= length s then | |
19 None | |
20 else | |
21 Some n | |
22 end | |
15 | 23 |
16 fun substring s {Start = start, Len = len} = Basis.substring s start len | 24 fun substring s {Start = start, Len = len} = Basis.substring s start len |
17 | 25 |
18 fun split s ch = | 26 fun split s ch = |
19 case index s ch of | 27 case index s ch of |