Problem

You need to check for any sequence of characters in a string.

Solution

The built in String method findString: returns the starting index of the substring or 0 if the substring is not in the string. Evaluate the following code in Dolphin Smalltalk for an example.

'Apples oranges, lemons' findString: 'lemons'

'Apples oranges, lemons' findString: 'dogs'

Technorati tags: