.replaceFirst(old,new)
Description
replaceFirst substitutes only the first occurrence of a substring with a new substring within a string. Unlike .replace() which replaces all occurrences, this method only changes the first match.
Parameters
replaceFirst needs two parameters:
old: the substring to search for
new: the substring to replace it with
Usage On Strings
Last updated
Was this helpful?