Computer Science Canada

help with changing portions of a word

Author:  scottyrush13 [ Fri Feb 24, 2006 8:46 am ]
Post subject:  help with changing portions of a word

We are supposed to make a program now that reads a line of text that the user inputs, and then change the spelling of words that end in 'or' to end in 'our'.

I searched through my book and the only thing I can find that changes spelling of words is

String s2=s1.replace ('*','*')

(s2 and s1 of course being the string variables, and * representing the letter you want to change with what you want it changed to).

However this doesn't work for changing multiple letters, like or to our, and I don't know how to make it change ONLY the words that END in or.

Any help that someone could offer would be very appreciated.

Author:  wtd [ Fri Feb 24, 2006 12:58 pm ]
Post subject: 

http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html

Have you looked at all of the methods that have "replace" in their name?

Author:  scottyrush13 [ Wed Mar 01, 2006 8:58 am ]
Post subject: 

Embarassed
Thank woo wtd!

Sorry for the lengthy wait for my response. I've been...catching up on alot of stuff.

Anyways, I'll be sure the search more thoroughly through my other resources before coming on to here to bug you people. Very Happy Laughing Wink


: