Java: Return a string where every appearance of the lowercase word 'is' has been replaced with'is not'
88. Replace 'is' with 'is not'
Write a Java program to return a string where every appearance of the lowercase word 'is' has been replaced with 'is not'.
Visual Presentation:
Sample Solution:
Java Code:
Sample Output:
The given string is: it is a string The new string is: it is not a string
Flowchart:
For more Practice: Solve these Related Problems:
- Write a Java program to replace all occurrences of the word "is" with "is not" in a string while preserving word boundaries.
- Write a Java program to insert "not" after every instance of "is" using regular expressions.
- Write a Java program to transform a string by adding negation to each occurrence of "is" that isn’t already followed by "not".
- Write a Java program to replace standalone occurrences of "is" with "is not" without affecting longer substrings.
Go to:
PREV : Check Happy Character.
NEXT : Sum Numbers in String.
Java Code Editor:
Improve this sample solution and post your code through Disqus
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.