String.replace()
Signature
String replace (String s1, char oldChar, char newChar)
Domain
ACTION, CONDITION, QUERY
Description
Returns a new string resulting from replacing all occurrences of oldChar
in this string with newChar. If the character oldChar does not occur
in the character sequence represented by this String object, then a
reference to this String object is returned. Otherwise, a new String
object is created that represents a character sequence identical to the
character sequence represented by this String object, except that every
occurrence of oldChar is replaced by an occurrence of newChar.
Parameters
Name | Type | Description |
s1 | String | A String to replace characters in. |
oldChar | char | The old char to replace in the String s1 . |
newChar | char | The new char to replace the old char with, in the String s1 . |
Returns
Type | Description |
String | A string derived from the String s1 by
replacing every occurrence of oldChar with newChar. |