[racket] Rosetta code submission / string operations

From: Eli Barzilay (eli at barzilay.org)
Date: Tue Jun 4 07:49:47 EDT 2013

An hour ago, Daniel Prager wrote:
> 
> (define (in? str sub-str)
>   (not (string=? str (string-replace str sub-str ""))))
> 
> Is there something I could have used out-of-the-box?

No -- eventually there should be these two things:

  (string-index str sub [start 0] [end (string-length str)])
  (list-index list elt [=? equal?])

but I'm not sure about the names.


10 minutes ago, Tobias Hammer wrote:
> I think regexp are the right choice:

Yes,

> (regexp-match? (regexp sub-str) str))

but it should be

  (regexp-match? (regexp-quote sub) str)

-- 
          ((lambda (x) (x x)) (lambda (x) (x x)))          Eli Barzilay:
                    http://barzilay.org/                   Maze is Life!


Posted on the users mailing list.