Replace Char In String

[Solved] Replace Char In String | Swift - Code Explorer | yomemimo.com
Question : string replace java

Answered by : fierce-fly-azid61sn3bfv

public static void main(String args[]){
String s1="my name is khan my name is java";
String replaceString=s1.replace("is","was");//replaces all occurrences of "is" to "was"
System.out.println(replaceString);
}} 

Source : https://www.javatpoint.com/java-string-replace | Last Update : Wed, 15 Apr 20

Question : replace character in string java

Answered by : important-impala-serdwt3t76w3

String str = ".............................."; int index = 5; char ch = '|'; StringBuilder string = new StringBuilder(str); string.setCharAt(index, ch); System.out.println(string); 

Source : | Last Update : Fri, 21 Aug 20

Question : Replace Char At Index Of String

Answered by : eric-tam

function replaceAt(index, word, replacement)
{
let partOne = word.substring(0, index)
let partTwo = word.substring(index, word.length-1);
let answer = partOne + replacement + partTwo;
return answer;
}
var s = new String("AAAAA");
for(var i =0; i<s.length; i++)
{ if(s[i]=="A") {
s= replaceAt(i, s, "@@@@"); }
}
console.log(s);
/*console.log() @@@@@@@@@@@@@@@@@@@@*/

Source : | Last Update : Sun, 03 Jul 22

Question : how to replace a character of a string

Answered by : repulsive-ray-8532ji4y9tu4

theSTRINGhere.replace('what you want to replace', '');

Source : | Last Update : Fri, 28 Jan 22

Answers related to replace char in string

Code Explorer Popular Question For Swift