Differentiate between Replace and Replace All.
Answers
Answered by
1
Answer:
The difference between replace() and replaceAll() method is that the replace() method replaces all the occurrences of old char with new char while replaceAll() method replaces all the occurrences of old string with the new string.
Explanation:
Answered by
1
Answer:
String's replace() takes either two chars or two CharSequences as arguments and it will replace all occurrences of char or String but replaceAll() method takes regex String as argument and replaces each substring of that matches given regex with replacement string.
Similar questions