Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Replacing one character with another in a string

Tags:

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?

like image 361
combo Avatar asked Jul 17 '12 07:07

combo


People also ask

How do I replace one character in a string with another character?

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.

What replaces one character with another?

Use the replace() method to replace a specific character with another.

How do you replace a part of a string with another string?

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.


1 Answers

=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.

like image 193
JimmyPena Avatar answered Oct 21 '22 15:10

JimmyPena