Mercurial > repos > tabletprog
changeset 301:5d24b3117aa7
Add startsWith? to string
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Fri, 25 Jul 2014 13:43:36 -0700 |
parents | ea94b1e43c97 |
children | aea99b93cf2f |
files | modules/string.tp |
diffstat | 1 files changed, 6 insertions(+), 0 deletions(-) [+] |
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 {