[racket-dev] `string-replace'
30 minutes ago, Laurent wrote:
>
> I meant this:
>
> (define (string-replace from str to)
> (regexp-replace* (regexp-quote from) str (regexp-replace-quote to)))
30 minutes ago, Matthew Flatt wrote:
>
> Surely Laurent meant
>
> (define (string-replace str from to)
> (regexp-replace* (regexp-quote from) str (regexp-replace-quote to)))
(Yes, that was a typo.)
If this is added, then that begs to also have something like[*]
(define (string-index-of sub str [start 0] [end (string-length str)])
(define m (regexp-match-positions (regexp-quote sub) str start end))
(and m (caar m)))
? If so, then what should it be called?
([*] untested, more typos possible.)
--
((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay:
http://barzilay.org/ Maze is Life!