[Newbies] determine if a String contains a String

Mark Volkmann mark at ociweb.com
Sun Sep 28 14:44:00 UTC 2008


On Sep 28, 2008, at 9:27 AM, Norbert Hartl 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'


Thanks! It looks like the method name is "includesSubString:". Notice  
the last capital "S". That seems weird. There is another method named  
"includesSubstring:caseSensitive:" where that "s" isn't uppercase.

---
Mark Volkmann






More information about the Beginners mailing list