comparison modules/string.tp @ 259:32964a4e7a33

Add ltrim method to string
author Michael Pavone <pavone@retrodev.com>
date Thu, 29 May 2014 18:51:15 -0700
parents 5b830147c1cd
children d6a4c9e7716e
comparison
equal deleted inserted replaced
258:fb922651db29 259:32964a4e7a33
255 self <- from: pos + (delim length) 255 self <- from: pos + (delim length)
256 } 256 }
257 pieces append: self 257 pieces append: self
258 } 258 }
259 259
260 ltrim <- {
261 l <- length
262 start <- 0
263 space <- " " byte: 0
264 tab <- "\t" byte: 0
265 nl <- "\n" byte: 0
266 cr <- "\r" byte: 0
267
268 while: {
269 if: start < l {
270 b <- byte: start
271 b = space || b = tab || b = nl || b = cr
272 }
273 } do: {
274 start <- start + 1
275 }
276 from: start
277 }
278
260 trim <- { 279 trim <- {
261 l <- length 280 l <- length
262 start <- 0 281 start <- 0
263 space <- " " byte: 0 282 space <- " " byte: 0
264 tab <- "\t" byte: 0 283 tab <- "\t" byte: 0