Mercurial > repos > tabletprog
comparison 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 |
comparison
equal
deleted
inserted
replaced
300:ea94b1e43c97 | 301:5d24b3117aa7 |
---|---|
301 } do: { | 301 } do: { |
302 end <- end - 1 | 302 end <- end - 1 |
303 } | 303 } |
304 from: start withLength: (end - start) | 304 from: start withLength: (end - start) |
305 } | 305 } |
306 | |
307 startsWith? <- :prefix { | |
308 if: (prefix length) <= length { | |
309 0 = (compareSub: prefix 0 0 (prefix length)) | |
310 } | |
311 } | |
306 | 312 |
307 endsWith? <- :suffix { | 313 endsWith? <- :suffix { |
308 if: (suffix length) <= length { | 314 if: (suffix length) <= length { |
309 0 = (compareSub: suffix (length - (suffix length)) 0 (suffix length)) | 315 0 = (compareSub: suffix (length - (suffix length)) 0 (suffix length)) |
310 } | 316 } |