I have a data like below:
A:B:C:D
and I want to replace the C
with data (say, Z
) so that it may look like
A:B:Z:D
How can I do it?
The Java string replace() method will replace a character or substring with another character or string. The syntax for the replace() method is string_name. replace(old_string, new_string) with old_string being the substring you'd like to replace and new_string being the substring that will take its place.
Use the replace() method to replace a specific character with another.
The replace() method returns a copy of the string where the old substring is replaced with the new substring. The original string is unchanged. If the old substring is not found, it returns the copy of the original string.
=SUBSTITUTE(A1,"C","Z")
Although I wasn't clear on whether you wanted G
or Z
, you mentioned G
but your example output shows Z
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With