[plt-scheme] Checking if strings are only whitespace

From: Robby Findler (robby at cs.uchicago.edu)
Date: Sun Mar 19 09:13:20 EST 2006

At Sun, 19 Mar 2006 12:26:28 +0100, Hans Oesterholt-Dijkema wrote:
> Dear All,
> I'm looking fot the fastest way of checking if a string only consists
> of whitespace. 

These both seem to be faster and the second is faster than the first:

(define (is-space? str)
  (andmap char-whitespace? (string->list str)))

(define (is-space? x) (regexp-match #rx"^[ \t\n]*$" x))


Posted on the users mailing list.