http://www.javabat.com/prob/p154137 Given a string, return a string where every
ID: 3611905 • Letter: H
Question
http://www.javabat.com/prob/p154137Given a string, return a string where every appearance of thelowercase word "is" has been replaced with "is not". The word "is"should not be immediately preceeded or followed by a letter -- sofor example the "is" in "this" does not count. (Note:Character.isLetter(char) tests if a char is a letter.)
notReplace("is test") "is not test"
notReplace("is-is") "is not-is not"
notReplace("This is right") "This is not right"
public String notReplace(String str)
{
}
I will rate lifesaver for your help, I am so confused on what to dowith this problem thanks for your help
Explanation / Answer
please rate - thanks import java.util.*; public class untitled1 { public static void main(String[] args) { System.out.println("is test:"+notReplace("is test") ); System.out.println("is-is: "+notReplace("is-is") ); System.out.println("This is right:"+notReplace("This is right") ); } static String notReplace(String original) {int i=0;String w; String find="is"; String replacement="is not"; String result = ""; while(iRelated Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.