[racket] Rosetta code submission / string operations

From: Tobias Hammer (tobias.hammer at dlr.de)
Date: Tue Jun 4 07:34:37 EDT 2013

I think regexp are the right choice:

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

On Tue, 04 Jun 2013 12:43:02 +0200, Daniel Prager  
<daniel.a.prager at gmail.com> wrote:

> I've just submitted a Racket solution to Rosetta Code for "I before E
> except after C" (no stretch goal yet).
>      http://rosettacode.org/wiki/I_before_E_except_after_C
> and noticed a couple of seeming omissions from the basic string  
> operations,
> or more likely the documentation.  I ended up rustling up a quick and  
> dirty
> test for whether one string includes another as a substring:
> (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 doubt I could  
> have
> used regular expressions, but that seemed like overkill.  I was also  
> unable
> to locate code for searching strings.
> Other feedback on my rosetta code also most welcome.
> -- Dan

Tobias Hammer
DLR / Robotics and Mechatronics Center (RMC)
Muenchner Str. 20, D-82234 Wessling
Tel.: 08153/28-1487
Mail: tobias.hammer at dlr.de

Posted on the users mailing list.