Mercurial > repos > tabletprog
diff modules/string.tp @ 301:5d24b3117aa7
Add startsWith? to string
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Fri, 25 Jul 2014 13:43:36 -0700 |
parents | 9a30510f6e52 |
children | 14b4e540af28 |
line wrap: on
line diff
--- a/modules/string.tp Fri Jul 25 13:43:25 2014 -0700 +++ b/modules/string.tp Fri Jul 25 13:43:36 2014 -0700 @@ -303,6 +303,12 @@ } from: start withLength: (end - start) } + + startsWith? <- :prefix { + if: (prefix length) <= length { + 0 = (compareSub: prefix 0 0 (prefix length)) + } + } endsWith? <- :suffix { if: (suffix length) <= length {