The trick is that 'whitespace' isn't just #\space. It's any sequence of
whitespace characters, like "\r\r\r" or " \r\n\t"

On Wed, Nov 2, 2016 at 12:12 AM, <meino.cra...@gmx.de> wrote:

> Hi,
>
> when using the search function for the Racket-docs
> with string-trim I found:
>
> -----------------
> Trims the input str by removing prefix and suffix sep, which defaults to
> whitespace. A string sep is matched literally (as opposed to being used as
> a regular expression).
>
> Use #:left? #f or #:right? #f to suppress trimming the corresponding side.
> When repeat? is #f (the default), only one match is removed from each side;
> when repeat? is true, all initial or trailing matches are trimmed (which is
> an alternative to using a regular expression sep that contains +).
>
> Examples:
>
>     > (string-trim "  foo bar  baz \r\n\t")
>     "foo bar  baz"
>     > (string-trim "  foo bar  baz \r\n\t" " " #:repeat? #t)
>     "foo bar  baz \r\n\t"
>     > (string-trim "aaaxaayaa" "aa")
>     "axaay"
> -----------------
>
> It says, that #:repeat is false if not given (the default).
> It looks like, that the first example has a little bug: Both
> #\space characters are removed from in front of "foo" - identical
> to the second example, where #:repeat is given (#t).
>
> ...or I need more coffee or more sleep... ;)
>
> Cheers
> Meino
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to