java replace character in string

Solutions on MaxInterview for java replace character in string by the best coders in the world

showing results for - "java replace character in string"
Sean
29 Jan 2020
1//short answer: you cannot individually change any specific character
2//of a String in java. You can however do this:
3
4String s1 = "This is a String";
5String s2 = s1.substring(0, 8) + "o" + s1.substring(9);
6System.out.println(s2);
7//Prints "This is o String", replaced the 8th character with an o
Lynn
21 Nov 2020
1String s = "new String";
2String replaced = s.replace("new","Test");
3							  ^		 ^
4                             old    new char
Zeb
16 Apr 2020
1// We want to replace every # with a 8
2String larry = "Larry is # years old";
3String newString = larry.replace("#", "8");
Isabel
17 May 2017
1String str = in.nextLine();	//Original String
2char cr = in.next().charAt(0); // character to replace
3int index = in.nextInt();	// Index where replaced
4str = str.substring(0, index) + cr + str.substring(index + 1);// modified string
5
Tommaso
01 Jun 2016
1String str = ".............................."; 
2
3        int index = 5; 
4  
5        char ch = '|'; 
6 
7        StringBuilder string = new StringBuilder(str); 
8        string.setCharAt(index, ch); 
9
10        System.out.println(string); 
Klara
26 Jan 2018
1public class JavaExample{
2   public static void main(String args[]){
3	String str = new String("Site is BeginnersBook.com");
4
5	System.out.print("String after replacing com with net :" );
6	System.out.println(str.replaceFirst("com", "net"));
7
8	System.out.print("String after replacing Site name:" );
9	System.out.println(str.replaceFirst("Beginners(.*)", "XYZ.com"));
10   }
11}
queries leading to this page
replace in a string javareplace chacter in string javahow to replace a char in a string javstring java change characterreplace in string in jva areplace a character at a specific index in a char arrayhow to replace a character in javajava replace char in string at index replace javareplacement in java stringjava replace a single character in stringstring replace in javahow to replace a char in a string javareplace with position in javareplace a char in a string in javareplace char with word javareplace char at index in string javastring replace 28char 2c char 29how to replace string at indexes with characters in javasubstitute string javareplace a char of a string with another charhow to swap the character of a string in javareplace a character at particular index in javaput particular character in string javachange elements in a string javahow to replace 2a in javajava replace texthow to change the value of a string in javahow to change character in string in javareplace character in int javareplace string java withhow to update a character value in stringchange string at index javareplace a character at a specific index in a stringhow to replace a character at an index in a string in javareplace character in striung javajava replace functionreplace character in string java with indexchange character in string javahow to replace a character from a stringjava replace character in string at inmdexhow to replace a character in a stringhow to update a character in a string in javacan we change the value of a chaa 3dravter in a string in javastring builder how to replace a characte with another character in javareplace ucharchange character string java replace 28 29 javajava string replacereplace characters in javajava string modify character at indexreplace java examplesreplace only single character in string javahow to change value of a particular index in string javahow to replace a word in strng from index in javareplacing characters in strings with replace 28 29 in javajava how to substitute a character in a stringhow to replace 5b in javahow to change the characters of a string in javastr replace javahow to vhange letter in javareplace character in strijng javatext replace 28 22 22 2c 22 2b 22 29 in javaset character at index string javareplace a char in a string with another javareplace character in string java using for loopchange character of a string javahow to change the string methodreplace a string javareplace a character with 5c javareplace with in javahow to replace a character in string in javajava program to replace each character in a string with its next letterhow to replace a character with a string in a string in javahow to move a character in a string javahow to change characters in a string javashow to set character at index in javajava string change characterhow to change the data inside a string javareplace the character in a string in javajava how to replace char in stringstring replace javahow to replace a chacter in stringreplacing data in strng in javajava set char by indexchange a char in string javajava change a character in stringhow can i replace character of string in javareplace character in a stringjava string modify charactersetting char for string javajava replace up to certain characters from stringhow to replace acharacter in a stringhow to replace a letter in a string javareplace all characters in a string javahow to replace a particular character in a string in javastring replace specific position javachanging single character of a stringhow to replace a character of a string in java by indexstr replace javareplace a character at a particular index in string javahow to change a specific character in a string javareplace text javajava string substitute stringreplacing certain character from a word javachange characters of a string javaprogram to replace some character in string javahow to set char in string javajava replace all instance of one character with a different character in a stringreplace character with 2f character in javastring replace functions in javareplace chat in stringreplace certain ccharector with another javareplace a string index with a charreplace method string javachanging character in string javareplace particular character string javajava replace 2c by in stringjava set character in string at indexjava replace something from a charreplacing the characters of a string javareplace character at ith index in string javareplace char in a string method in javahow to change chacter value in java steringreplace a character in string javareplace character in string java at indexstring replacereplace javsreplace char in stringhow to replace a character at a particular index in a string in javajava change a char letter with anotherreplace character in strng javahow to replace char in a string javareplace character from stringreplace index in string javastring change characters javareplace character at an index in string javahow to replace a index value of string with another in javahow to replace 5c in javaprogramming in java typing letter replaces old letterchar array replace javawrite a java program to find a character from a sentence and replace it with another character java replace charsequencereplace character in a string in javachange specific character from string javareplace character in string with string in javahow to replace a char in string at any given position in javahow to replace different words in java from stringreplace in java stringjava replace a character in a stringreplace substring with indicesstring replace java questionshow to replace a char in a character list javahow to use replace method in javacharat java changestr replace in javareplace 2f with 5c in javachange a char in a string javahow to change the character in a string javahwo to change cahracter in text in javastring contains and replace in javajava replace variables in stringreplace 22 5c 22 javareplace the charcater in a stringhow to replace only a particular character in a string in java 27 27 replacing with 2f in javareplacing certain character from a string java replacing with 2f in javareplace a char from a stringjava regex replacehow to replace 5c char in string javahwo to change character in index in javareplace a character at a specific index in a char array javaassign character of string at indexfind and replace string in javareplace string value with others javahow to change an character in a string in javahow to change a specific letter of string in javareplace 2f 2f in javastring substitute characters javastring replace some caracters javareplace a character of string in javahow to replace a letter in string javareplace char string javareplacing character in stringjavajava replacing characters in a stringhow to replace a int character in a string in javajava replace char with an charreplace certain values in a string javareplace char in words in javareplace javajava replace stringsubstitute character code javajava string replace 5cjava replace 3f charectoerhow to set a char in a string javajava change single char in stringhow to replace a single position in java stringreplace index with stringreplace 22 javareplacing single character in a string arraychange character in string how to set a character in a string in javareplace text in string javahow to replace specific character from string in javajava replace string in stringjava string substitutereplace 28 22 2f 22 2c 22 22 29 character in string javahow to replace some character to an another character in javahow to replace a substring with a char javareplace characters from the stringsupdate a character in java stirngchange character of a string in javastring replace jaastring find and replace javahow to replace letters in a string in javareplace char in javahow to replace characters in a string in javaupdate char in string javajava string replace charreplace character in string java using indexchange a character in string javasubstitute char in index javareplace a charater with a string javastring replace char in javareplce character in string javastring replace string by index javajava string replace a character at indexstr replace javareplace letter in javareplace character in string java from any charater in other stringstring replace methodmodify character in string javajava replace exampleset character methode in string javastring replace javahow to replace a character with another character in a string in javajava how to change letters in a stringreplace char at specific index javareplace character in string programjava replace index of stringreplace java tutorial change a single character of a string in javahow to get the replcce charecter of a string in javccajava program to replace a character in a stringreplace characters ins tringreplace charecter into stringreplace a char with a string in javahow to repalce certain symbols in a string javareplaceal javahow to change indexing of a stringreplace character at index in string javajava code to replace characters in a stringchange a letter in a string javahow replace char in stringjava replace characters in a string with another stringreplace index of string with another char javareplace string with regex javachange a character in a string javareplace in java for stringjava string change character at indexreplace values in string javajava find and replace using indexofhow replace 24 in string in javastring character replace javareplace 28char 2c string 29 javacan we replace character at an index in string javahow to change character at an index in string javareplace a char in a word javareplace function javahow to replace char in sstringreplace all of a certain ccharector with another java in stringchange only one character in string javachar in a string replace with index in javarepace text in javastring replacejavareplace certain characters from string javajava replace specific character in stringjava replace char at indexhow to change a char in string javareplace letter string with index numberreplace character index javareplace index character in string javajava replacing characters in a index of a stringstring replace characterhow to change character inside a string javareplace method javarepace a letter in string in javajava string replace character with stringjava replace character in a stringreplace first character in string javareplace a word in a character string javajava change char in stringreplace an index with a character in string javahow to do string replace by indexjava replace string character at indexusing a for loop to replace a character in a string javahow to replace a chracter in a string javahwo to replace a single character out of a string in javareplacing characters in a string at an index javareplace something in the stringreplace char in char list javajava how to change a character of a string 40 replace javajava find and replace in stringhow to change a character at an index in javachange character in java stringreplace string character javajava string replace character with character 2b anotherhow to replace a single character in a string javareplace char at in stringreplacing a character inside a string javajava edit char of stringhow to replaca a letter with a letter javaset character in string javareplace string by string javahow to replace a character in index in string in javajava change character of stringhow to change a character of a string javahow to rename string class javahow to get replace character of string in javahow to replace a character in a string in jkavajava replace c3 b2 with ohow to change a letter in a string javahow to replace character from a string in javajava writing replace methodreplace caharcter in string 5cjava replace in stringclass that implement string replacement in javareplacing char at specific position in javahow to set the value of a char at an index in a string javajava replace a character in a string at a indexreplace a char in javahow to replace a word in a string in java using replace methodchar java method to replacesubstitute a character in string javastring replace by index javajava metod replace string charactersjava replace char with stringhow to replace one character in a string in javahow to replace a single character in a string in javareplace string characterhow to replace a single character in javahow to replace a specific character in a string in javahow to replace words in a string javaset char at index javareplace ch in string javareplace charat index javastr replace in javareplace function in java stringreplace megthod in javahow to alter a character of a string in javaset character in javajava string change character at positionstring replace character in javareplace character string javasreplace specific characters with new characters javastring replace letter javareplace letter from inded ofwrite a program to replace a character of a given string at a given position javahow to replace only one character in string in javachange specific char in string javahow to replace a particcular index character in string javajava change string characterhow to replace some part in string in javajava replace 22 in stringhow do i replace a certain index of a string in javajava replace a characterhow to switch letter position in javahow to replace a string in javachange a character in a string in javahwo to edit char in tring javahow to replace a character in a string in javareplace injava i 3dfor stringsjava replaces instances of char in stringhow to change char to string in java and replace a charaterhow to replace string characters in javafor replace char in stringjava replace exluding charjava replace characters stringshow to set a character in a string with another character javachange character in a string in javareplace each letter in a string with a indexjava program to replace occurrences of specific char in a stringhow to replace a character with a 2b in javahow to replace strings in javareplace symbol in string javahow to change a character in string in java change one char string javaset char in string javachar replace charhow to change a character at index in string in javahow to replaceall characters to another set of characcters in javastring replace at index javajava string replace at indexjava replace contentchange value of string at some position in javareplace 2c with 22 22 javajava string replace character at positionjava replace one character in stringchange one letter in string javahow to change char in string javachange a string at an index java how to replace a char in a stringreplace character at position in string in javajava replace character at indexhow to change the value of character in string in javareplace chars in string javasearching for a character in a string and replace it javastring how to change character in javareplace a cetain character in a string javahow to replace a string with another stringjava replace in stringstring replace char at index java start endreplace char of a stringcharacter substitutions javahow to modify a char in string javastring replace on given index javaandroid string replace character at indexjava program to replace each character in a string with it 27s next letterjava replacing characterreplace 5b character in java stringreplace a char in string with indexofhow to find and replace a character in a string in javareplace 2a from string javahow to change value of a string in javahow to replace a letter with another in java stringjava replace characters in stringjava modify string at indexhwo to change character in stinr gjavahow to replace a char in javajava 7b 7d replacehow to change character in string javahow to change a string 27s character at any index in javajava replace caracterehow to use replace in javareplaaaaaace a char javahow to replace character at particular index in javareplace character in a string javareplacing a character in a string javahow to replace letter in string javachange char in a string javareplace position in string javareplace a char with another javahow do i replace a letter in a string java replace in javastring replace letter at indexreplace single char in string javareplace full stringwith anther string in string replace a one char in jav ajava replace only one character in a stringjava replace charactersjava replace 7b 7dreplace in javareplace string from index javachange string character javastring replace javastring replace 2f with 5c in jaahow to set char at index in javareplace a string in javajava string replace char in stringhow to replace a charatcter in string in javachange character of string javachar replacement in javareplace character in java stringhw to replace lettes in string with characters in javahow to change character in string array at index zero in javahow to replace chars in string javacan i change string char in javareplace any charcter in string javafind replace string javachange character of index in javareplace characters string javareplace string with symbolhow to replace the value in javahow to replace char in string in javahow to replace the 2a char in string replace all javadifferent ways to change string in javareplace any index 27java replace a character in a string at an indexreplace a character in array javareplace string jacarelapce in javareplace strin character javahow to replace string 2b to operator in javajava replace line breaksjava string replace examplesreplace a char with a stringreplace char javachar in a string replace in javareplace a char in a string javawrite a java program to replace certain characters from string replace characters on stringjavajava replace all character in stringjava string replace character at indexreplace a character from string in javahow to replace char in a string by index javareplace a character at a specific index in a string in javareplace several characters in string by index javareplacement character javajava how to change a character in stringchar java method to replace char wit numberhow to replace a character at an index in javahow to change value an any index in string javareplace string javajava replace substringcode to replace in javareplace a character in a string javajava replace the character based on indexreplace a character in a string in javahow to replace a character in a string at a particular index in javastring set char at locationreplace character based on index in javahow to change individual letter in string javareplace string at particular index in javareplace chars in javajava replace string at positionreplace text character java at indexjava string replace at posreplace at index in string javastringbuilder replace character at index javareplace a character in string javjava replace 22 charjava replace characterreplace chars method javareplace text character javajava replace string at indexreplace character in string builder in javajava string relplacingscala replace letters by indexreplaceall character in string javareplace one character in a string javareplace character at position javachar replacecanging character on a string in javastring modify a certain caracter javastring replace 2fletter in javareplace in stringsprogram to replace a substring in a string in javahow to replace a letter at specific place in a string javajava find character in string and replacestring replace charjava replace substring in stringstring replace at indexjava replace charreplace characters in stringreplace 5c 22 with 22 in strings javareplace methods in javahow to replace some character in string in javareplace method injacareplace a value at an index string javajava replace the 22 5c 22 in a stringreplace string beinging chars javastring replace method in javajava string substitutionhwo to replce speciif indexes tring javahow replace 22 26 23 in itring in javareplace character at particular index in javajava replace set of characters in stringhow to replace a char acter in a string in javahow to replace characters of string in javahow to replace a character 22 2c 22 in a string in javahow to replace a character at a particular index javastring replace other language in javadeleting characters from a string and adding it to a new one javahow to replace 2f in javahow to change a char of a string in javafind and replace in a string javareplace 1 char in string javareplacing a specific value in a string javahow to use replace 28 29 in javajava substitute characters in stringhow to change the value of a character in a string in javajava replace string characterstring replace in javahow to replace at specific character in string in javachange single cahtor of string javasetting characters in stringjava replace 1 char in stringreplace a character from a string javareplace java stringreplace a charcter in javastring indexreplacereplace certain ccharector with another java in stringreplace char string in javajava change string elementreplace a part of string in javareplacing a character in a string in javahow to replace charracters in a string javareplace char with another javareplace string by index javajava replace methodreplace method in javachange individual string character javahow to replace a character at particular index in javahow to replace a letter in a string by it 27s indexhow to replace in string from specific index to specific indexs replace a given substring in javajava string replace at charreplace character in string java o 281 29replace a character with a string in javafind an element and replace it with another string using javahow to replace characetrs with others in javahow to change a particular character in string in javajava string format replace character with 21string replaceall javahow to chane any charater of a stringjava replace indexreplace text from string javahow to replace characters in a javajava replace specific characterreplace char java stringstring index replace javachar replace in javareplace java charactersreplace function in javahow to change a value in a string in a specific spot in javajava string replace replacereplace characters in a string in javahow to replace characetrs in javareplace fun in javajava replace 7b 7d string replace all characters with 2a javareplace character at specfici index javajava string replace char indexjava replace string with charreplace char in string java mrthod 5creplace character from string in javahow to replace a character in a string in java without using replace methodstring replace method javahow to replace a character of a string in java how to replace a character in a string in java with indexreplace character at position in javastring replace javjava string replace char at indexreplace 2f 2c in javastring methods java replace indexusing replace in a string in javareplace character in string javahow to replace a char for a space in the middle of a string javareplace char of string javajava replace 7b 7d string javareplace char in string java at indexreplace string specific position javareplace function jaareplacing things in strings javahow to replace an index in a string javachar in a string replace with index in java using inbuilt functionhow to read character of strings and replace it in javahow to use replace functionin javajava replace codehow to replace character in string in javause if method to change character in string javahow to change a character in a stringjava replace character by indexreplace char index 0 string javahow to replace 3f with a character in string javasetting a value of string at given index javahow to modify strings javachar replace javajava string replace char arrayreplace a character in an array by another onestring replace char at index javareplacing characters in a string javareplace a character in a string java using indexcan you change a character in a stringhow to replace certain characters in a stringjava replace caracter in positionreplace string with another string javajava string replacereplace a char from a string javahow to change one string character javareplace different chars in string javachar replace javareplace char at position javareplace a letter in string javareplace char in string at index javachanging characters in a string javahow to replace in string in javareplace a char at an index in string javarepplace string char with another string character javareplace values in string in javareplace 1 character in string javahow to change value of string at particular position in javachange the value of a string indexjava replace char in stringhow to replace a character in a certain index in a string in javahow to replace a character in a string using javahow to change the text in a string javareplace characters in a string javajava replace character in string at indexstring method to replace a letter in javahow to set a char at an index location of a string javareplace a string with another string in javareplacce string in a stringjava replace character in stringreplace a char in stringupdate character in string javaeasy way to replace a part of a string with a char in javareplace at a specific index in a string javahow to change character in a string in javajava substring remplacereplace a character with other character in stringreplace character in javastring replace character javareplace string javastringhow to replace 27 5c 27in stringhow to replace a charater in javahow to replace elements in a string javastring replace character at index javawrite a java program to change a specific character in a file with a new characterreplace all characters with 2b in javareplace character of string javahoe to change a particular character of a stringreplacing in string javareplace a string character in javahow to edit characters in string javajava replace character string replace chracter at indexreplace index of string javahow to replace the first position of a string in javahow to replace char in string javahow to chacng char in stringreplace character in string in javareplace char index in string javaset char in stringreplace char in stirng injvahow to modify a string in place in javajava replace letter in stringhow do i replace a certain index in javachar replace in stringreplace current string with new in javachanging a character in a string javahow can we replace character in java stringshow to replace a set of char in a string in javareplacing a character in string via substringreplace a character from a stringreplace a char in a stringreplace string in javareplace 22 22 javareplac eusing index position in string jacacharacter replace javareplace string at index in javaword replace specific letter java indexhow to edie strings javahow to get replace characters of string in javahow to replace a character in a string in java at indexhow to replace a letter in a string by its indexhow to change a character in a string javajava how to replace a character in a stringhow update char in stringsreplace method in string in javajava string set char at indexchange single character in string jaavastring replace value at indexchange place on a character in string javahow to replace characters in a string javareplace single character in string javareplace at the index in string in javasjava string replacereplace characters in array javastring replace at index javahow to change a value at an index in string javajava replace character in string with indexjava replace a single char in a stringandroid string modify one characterchange one character in string javastring replace a character javareplace a string with another string in ajavastring replace in java regexjava replacereplace string from index to index javareplace 22 with 27 in javastring replacemnet 7b 7d in javajava replace all char withhow to replace a string with another string inside a string in javajava how to replace char of string at an indexhow to replace text in javastring particular index value change javajava stringbuilder replace characterhow to use replace function in javareplace character with 40 in javareplace 24 in string javahow to replace a substring in java using replace methodjava string index value to replace charjava replace a word in stringhow to replace the character in string in javaedit a stringjava string replace 3fhow to change character of string in javahow to change a char at ith pos in a string in javareplace string with indexreplace string with another stringchange char at string javaupdate a character in java stringstring character replace in javareplacing characters in a sentence javastring replace at index javahow to substitute characters at index in a string in javahow to replace character in stirng javareplace specific character in string javahow to replace char with string javareplace a string in another stringhow to replace character in stringstring replace charchange char insude string javastring replace java string to charreplace all of a certain charector with another java in stringreplace the characters in a string in javahow to change a string javachange string in another method in javareplace all char in string javahow to change character in java stringhow to replace in string from specific indexjava char to stringjava replacereplace a char from an stringstring replace char javajava how to replace characters in a stringreplace char in string javareplace char in a string with indexescharacters replace in java by indexreplace java charhow to change the characters of a string in kavahow to rplace a charecter in string in javareplace char in string in javareplace a letter in a string javajava replace character in specific index java replace 5c in stringreplace string java onlinereplace liketstring javareplace letter javahow do you replace a character in a string in java 3freplace in string javahow to replace value in string javajava string replace from to indexreplace a given character to a string in javajava string replace by indexhow to replace a char in string in javabuild a ne string replcing charcters javareplace at index javahow to set character in string javareplace 27 3f 27 in stringjava modify character in a string at an indexhow to use replace in java for stringjava string replace cahracterreplace the heating element in string in javamodify char in string javahow to change single character of a string in javajava change one char in stringhow to replace a char in a string in javacan you use replace with charatreplace in java string at some positionhow to replace a character in a string javajava replace all character from textjava string replace characterreplace method in strings in javajava string replace substringreplace value in stringreplace a char in string javachange index of string javahow to change string in char javamodify single char in stringreplace a character in a stringjava modify character in a stringchange char in string javajava change 1 character in stringhow to replace a character in a string python with index javaalter string at index javahow to replace code in javareplace character in stringhow to change string in javareplace letters in a string javachange the string in javahow to change the char in string javahow to update string at index in javahow to change char in a string javahow to change the character of a string in javahow to over write a given string in javareplace a particular character in a string javahow to replace a char in a string with anotherhow to replace characters in a stringrepalce a char in a string javareplace character with in java stringreplace char with other javacreating a method in java using replacereplace letter in string javamove characters in string javahow to replace specific character in string in javajava set char at string replace 28 29 with index javareplace things in strings javahow to replace string in javareplace a character in string in javahow to overwrite letters in a string in javareplace char index string javajava how replace 27how to change one letter in a string javacharacter replace in javareplace char in string index javawrite a java program to find a character from a sentence and replace it with another characterjava code to replace a character in stringreplace at index a char in string javareplace substring in javareplace char with another char javareplace charat stringmodify characters in string javareplace charshow to change character of a string in javareplace a character in a stringjavahow to replace a string character in javahow to rewrite a string in javajava string replace indexhow to change a character in a string in javahow to substitute characters in a string in javajava how to replace a character with a series of charactersreplace a character at index in stringjava change character in stringreplace 2f in javajava replace string with another stringreplace letter in strning javahow to repace stringstring replace index javafind and replace in javajava find and replace character in stringreplace index with letter stringhwo to replace characters in javajava replace 26 by c2 a7how to change string characters javajava replace character in string