[racket] Rationale behind missing string-trim
Thanks Eli!
--
Chad Albers
On Thu, May 24, 2012 at 2:19 PM, Eli Barzilay <eli at barzilay.org> wrote:
> About two weeks ago, Chad Albers wrote:
>> Thanks Eli. I'm happy you recognize the issue.
>>
>> I did write my own string-trim-both function using Racket's regexp as follows:
>>
>> (define (string-trim-both string)
>> (cadr (regexp-match #px"[\\s]*(\\S+)[\\s]*" string)))
>
> Note that this doesn't work right:
>
> -> (string-trim-both " str ing ")
> "str"
>
>
>> May not be the best, but it works. Even though it's easy to
>> implement, my issue was why it wasn't included. I guess I'm just
>> used to such utilities functions being provided for free in the
>> language I usually work in: Ruby. I was surprised that I had to
>> either 1) roll my own, or 2) require the srfi-13.
>
> Sidenote: `string-trim', and several additional simplified string
> functions is now in the repository and will be included in the next
> release.
>
> --
> ((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay:
> http://barzilay.org/ Maze is Life!