[Newbies] determine if a String contains a String

Rob Rothwell r.j.rothwell at gmail.com
Sun Sep 28 14:37:21 UTC 2008


While we are on the subject, is there an easy way to replace a substring
with another one?  I couldn't figure out any other way than to collect: the
substrings and then put them back together...
Rob

On Sun, Sep 28, 2008 at 10:27 AM, Norbert Hartl <norbert at hartl.name> wrote:

> On Sun, 2008-09-28 at 09:12 -0500, Mark Volkmann wrote:
> > What's the recommended way to determine if a String contains another
> > String?
> > I found one way.
> >
> > '*substring*' matches: string
> >
> > I'm sure I could use a regular expression, but that seems like overkill.
> > At first I thought I should use include: or contains: from Collection,
> > but apparently not.
> >
> > ---
> string includesSubstring: 'substring'
>
> Norbert
>
> _______________________________________________
> Beginners mailing list
> Beginners at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/mailman/listinfo/beginners
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/beginners/attachments/20080928/edda04e6/attachment.htm


More information about the Beginners mailing list