On Thu, Mar 31, 2011 at 7:38 PM, Charles Hixson <charleshi...@earthlink.net> wrote: > Hi, > I'm trying to determine whether the last non-whitespace character of a > string is a colon, and I haven't been able to figure out the best way of > doing this. In python I'd just trim the string and look at the character > before the end, but while Racket seems to have a string-length function, it > doesn't seem to have anything analogous to trim. So how should it be done? > > The best I've come up with is to explode the string into a list of > characters, and handle it that way, but that's clearly quite wasteful of > both processing and RAM. (Of course, part of it is that the best way I've > figured to proceed from there is to then copy that list to another list > checking at each step of the way to tell if I was done, and then if it was > successful to join the resultant list back into a string.)
Charles, See the documentation on regular expressions. http://docs.racket-lang.org/reference/regexp.html --Carl _________________________________________________ For list-related administrative tasks: http://lists.racket-lang.org/listinfo/users