Tuesday, September 29, 2009

lab test 1

From a given string, replace all instances of 'a' with 'one' and 'A' with 'ONE'.

Example Input: " A boy is playing in a garden"

Example Output: " ONE boy is playing in one garden"

-- Not that 'A' and 'a' are to be replaced only when they are single characters, not as part of another word.

-- You cannot use "replace" or "replaceAll"

No comments: