Mercurial > urweb
comparison lib/ur/string.ur @ 2022:1a4b2b983889
Change String to avoid Char dependency
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Wed, 11 Jun 2014 08:31:14 -0400 |
parents | 2da693675de9 |
children |
comparison
equal
deleted
inserted
replaced
2021:2da693675de9 | 2022:1a4b2b983889 |
---|---|
90 fun trim s = | 90 fun trim s = |
91 let | 91 let |
92 val len = length s | 92 val len = length s |
93 | 93 |
94 fun findStart i = | 94 fun findStart i = |
95 if i < len && Char.isSpace (sub s i) then | 95 if i < len && isspace (sub s i) then |
96 findStart (i+1) | 96 findStart (i+1) |
97 else | 97 else |
98 i | 98 i |
99 | 99 |
100 fun findFinish i = | 100 fun findFinish i = |
101 if i >= 0 && Char.isSpace (sub s i) then | 101 if i >= 0 && isspace (sub s i) then |
102 findFinish (i-1) | 102 findFinish (i-1) |
103 else | 103 else |
104 i | 104 i |
105 | 105 |
106 val start = findStart 0 | 106 val start = findStart 0 |