java replace character

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

showing results for - "java replace character"
Macy
16 Oct 2018
1public static void main(String args[]){  
2String s1="my name is khan my name is java";  
3String replaceString=s1.replace("is","was");//replaces all occurrences of "is" to "was"  
4System.out.println(replaceString);  
5}}  
6
Rayan
07 Jun 2018
1String s = "new String";
2String replaced = s.replace("new","Test");
3							  ^		 ^
4                             old    new char
Maja
11 Sep 2020
1// We want to replace every # with a 8
2String larry = "Larry is # years old";
3String newString = larry.replace("#", "8");
Debora
21 Jan 2019
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); 
Magdalena
23 May 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
how to replace a character in a string javareplace in stringsfind replace string javajava replace 5breplace a letter in string javastring replace on replaces sting oncereplace 22 with 2f 22 javajava replace all char withstr replace in java strin replace 2f 2f with 2f javapython string replacestring replace value javareplace in strings javajava replace 7b 7d string replace a cetain character in a string javareplace a string with another string in javajava code to replace a character in stringreplace the characters in a string in javajava how to replace a character with a series of charactersreplace character in strijng javahow to replace 22 in a string javais the replace method of string class staticjava string replace in placereplace liketstring javareplace substring javajava metod replace string charactersjava char to stringreplace symbol with to get stringstring replace method javajava string relplacingchange java stringsearching for a character in a string and replace it javareplace 28 29 is method of string class in javahow to change a character in a string in javahow to change a particular character in string in javahow to replace a character in a stringreplace 22 22 javastring find and replace javajava replace characters in stringhow to replace substring in javahow to replace a character in string in javahow to replace in string in javacharacter substitutions javahow to change the data inside a string javahow to replace a set of char in a string in javareplacce string in a stringstring replace 28 29 javawhat java will be replacehow to change value of a string in javahow to replace a char in a string with anotherreplace character at an index in string javajava str replacehow to replace 2f in javareplace 28 29 javafor replace char in stringreplace 5c 22 javareplace function in java for staringstring replace java 5creplace 24 in string javafind an element and replace it with another string using javareplace a character in string in javahow to replace specific character in string in javareplace a word in javareplace at index a char in string javachar java method to replacereplace char in strinc replace string value in javajava replace a character in a string at a indexreplace string in string array in javastring replacereplace a substring in javajava string replace 28 29 method using loopsjava replace for 24how does the replace function work in java 2f replace in java stringreplace string javastring replace in javastring replace java in poitionstring method for character replacementchange a character in a string javareplace a char from a stringreplace certain characters from string javareplace func javareplace chars in javareplace in string in jva awhat can i replace 7c 7c in javareplace a charcter in javahow to replace a character in a string in java with indexstring replace functions in javastring replace 5b in javahow to change a specific character in a string javajava replace string in stringjava string replace 3fin string replace a one char in jav ajava replace 28string relace javajava replace exampleuse replace 28 29 in javajava string replcehow can you change a string value in javareplace function in java stringstr replace javareplace a string with another string in ajavajava replace stringjava replace 5c in stringreplace value in stringhow to replace a charatcter in string in javahow do i replace a letter in a string javahow to replace a character with a 2b in javareplace a value javajava replace c3 b2 with ojava replace 7b 7d string javahow to change char to string in java and replace a charaterhow to replace certain characters in a string replace replace javareplace 22 with 5c 22 in a stringreplace a charater with a string javareplace a character with other character in stringjava replace char with an charjava replace character in a stringreplace character at position in string in javareplace string character javajava streing replacejava replace value in a stringreplace a string inside a string javastring replacemnet 7b 7d in javareplacing characters in strings with replace 28 29 in javareplace 2f 2f in javareplace character in javajava writing replace methodhow to replace 28 in javareplace char java java string replacehow to replace string characters in javastring method to replace a letter in javahow to replace 2a in javacan we replace character at an index in string javareplace a character in string javastring remplace javastring 5b 5d replace in javareplaaaaaace a char java 22 5c 22 to str replace in javaoverwrite string javahow to change a character of a string javahow to replace a value in string in javawrite a java program to find a character from a sentence and replace it with another characterjava replace char with stringjava replace specific character in stringreplace a char in a stringhow to replace elements in a string javareplace a string character in javajava replace 22 chardoes java have a replace function for stringsreplace characters in a string javastring replace javachange character in string javareplace chars method javajava replace string valuereplace string javastringhow to replace characters in a string javahow to replace text in javajava replace 5chow to change char in a string javastring replace java docsreplace 2a from string javachange character of string javareplace 28 29 string javajava string replace 22replace a character at a specific index in a string in javahow to replace a letter in a string javareplace a string in another stringstring replace javcareplace 1 character in string javareplace character in a string javajava replace 27replace 27 3f 27 in stringreplace single character in string javareplacing in string javajava replace string with charreplace with in string javahow to replace a string character in javahow to replace a letter in string javajava replace to stringreplace string with regex javareplace a character with a string in javajava program to replace each character in a string with it 27s next letterreplace old string with new string in javareplace character in int javareplace function for strings in javareplace method string in javareplace char in stirng injvareplace charecter into stringhow to replace 22 with 5c 22 in javahow to replace a substring with a char javahow replace 24 in string in javajava find relace stringreplace 2f in javareplace 28 29 in javajava replaceall return typeshow to modify a char in string javareplace character from stringhow to replace some character in string in javareplace java tutorial how to replace different words in java from stringstr replace in javajava string 7b 7d replacereplace method stringchange string in another method in javajava how to replace characters in a stringjava string substitutereplace 5b character in java stringhow to replace character from a string in javareplace 2f with 5c javareplace letter javareplace java methodjava string variable replacereplace character at particular index in javafind in string and replace javareplace character of string javarelapce in javareplace 22 7d 22 javastring replace charjava replace all character in stringwhy i can replace 28 22 5c 5c 22 29 in string in javajava substitute stringjava efficient replace stringreplace function in bluejhow can i replace character of string in javahow to replace string in javastring replace in pjavahow to replace 3f from string in javareplace a char in a string javajava replace string replacejavahow to replace a character at an index in a string in javastring replace pattern javareplace text character javareplace character in string java using indexjava how to replace char of string at an indexcode to replace in javajava change string in a methodchar replacement in javajava string replace methodreplace a word in a character string javajava string replace character with character 2b anotherjava replace string characterjava replace textreplace character in string programto replace javahow to change the value of a character in a string in java replace string javahow to replace a char in a string in javajava string replace character at indexreplace current string with new in javareplace different chars in string javahow to get replace character of string in javastring replace function in javastring replace other language in javahow to replace substrings in javareplace in string jjava change string characterreplace example in string javahow to replace a character at a particular index javajava string replace examplesreplace string with other string javahow to replace the character in string in javajava replace orjava replace character in string with indexstring java replace stringstring replace function javareplace string jvareplace 5c javareplace character with 2f character in javafind string and replace in javajava find and replace in stringreplace java charjava replace all character from texthow to replace something in javareplace method in javahow to replace character in string in javareplace strin character javareplace javasreplace all of a certain charector with another java in stringstring replace in java regexjava string replace substringstring replace methodreplace 22 22 in string javareplace with 24 in stringhow to replace a character in a string in java at indexhow to replace a char in javajava replace stringreplacing certain character from a word javareplace 2c with 22 22 javahow to replace parts of a string in javachange character by another javajava string pattern replacehwo to replace characters in javareplace character in string java using for loophow to use replace 28 29 in javajava replace 2b in stringjava string replace functionmethod replace javareplace string java withreplace string jacahow to replace with 5c javahow to replace a char in string in javastring replace example javachange specific character from string javacharacter replace in javasubstring replace in javareplaing charcters in java stringreplace char java stringhow to change character in string javajava string replace using patternreplace function in java for stringjava replace 7b 7dhow to replace char in string javachar in a string replace with index in javareplace strat with string javahow to change the character in a string javareplace char in string javastring replace char with replace string function in javareplace 2f 2c in javatext replace 28 22 22 2c 22 2b 22 29 in javajava find character in string and replacechange char in a string javajava string replace 28 29strring replace function in javajava replace method stringhow to replace a character with another character in a string in javajava replace 22 22 in stringreplace character in string java from any charater in other stringreplace char with word javahow to replace 5c 3b in javawhy i can replace 5c 5c in string in javareplace function javahow to replace code in javahow to replace characters in a stringstring replace 2f with 5c in jaareplace java 5c 5djava 22 replacereplace letter in string javajava built in replace methodscan i change string char in javahow to replace 3f with a character in string java replacing with 2f in javajava how to replace string textreplace character with in java stringhow to replace 2c in string in javachar java method to replace char wit numberreplace method string javareplace a character at particular index in javareplace 2f with in javastring replace letter javahow to replace some part in string in javareplace in javahow to replace a substring in java using replace methodhow to replace 3a using replace method in javareplace 2c in string javahow to replace 5c with 5c 5c in java stringjava program to replace each character in a string with its next letterreplacement character javarepace a letter in string in javareplace text from string javastring replace 25s javajava replace letter in string with anoter letterreplace 5c with 2f in java stringreplace 28 29 in javareplace one character in a string javajava replace string with stringjava replace line breakss replace a given substring in javareplace character in stringreplace something in the stringjava replace 22 on stringhow to alter a character of a string in javahow to replace 5c in javajava replacing characters in a stringreplaceal javastring replace with 2fjava replace text in stringreplace first character in string javastring substitute characters javareplace all characters with 2b in javahow to change character in string in javareplace a substring with another string in javastr replace in javastring replace javaupdate a character in java stringhow to replace charater in stringreplacing certain character from a string javajava replace methodwhat does replace method do in javareplace a character of string in javastring java change characterjava syntax of replace for stringjava string find and replacereplace string by string javareplace a given character to a string in javajava replace character in string at indexjava replaces instances of char in stringreplace a part of string in javareplace character in string builder in javareplace strings javareplace chat in stringstring method to replacehow to replace letter in string javajava replaceall stirngfind and replace in a string javajava string replaceall examplejava replace character in stringjava replace a word in stringhow to replace a char acter in a string in javareplace method of string in javahow to use replace method in javajava replace method stirngreplacing a character in a string javajava replace character string replace a char with a string in javareplace a character in a string java using indexreplace text in string javareplace ucharjava how to replace a char in a stringreplace all characters in a string javachange a char in string javareplace a letter in a string javahow to change the char in string javareplace substring in javareplace character in string javareplace 5c 22 with 22 in strings javareplace values in string javajava replace a substringjava replace value of stringreplacing characters in a string at an index javareplace funtion in javachar replace javastring replace char in javareplace letter in javareplace char sequence javareplace method in java string 2b 3d replace javajava replace string methodjava string replace 3fjava string replacingbuild a ne string replcing charcters javastring 2creplace javacreating a method in java using replacehow to change char in string javachanging character in string javajava string substitute stringjava how to change a character in stringreplace the heating element in string in javareplace 28 29 method in javareplace certain values in a string javahow to replace a character in a string in jkavajava how to substitute a character in a stringreplace 28 22 22 2c 22 22 29 in javahow replace 22 26 23 in itring in javahow to swap the character of a string in javareplace string beinging chars javajava replace caracterejava replace functionfind and replace string array javajava replace contentreplacing a character inside a string javajava substring remplacereplace char of string javastring java replace substringreplace method in string in javahow to replace char with string javastring replace 2fletter in javareplacing characters in a string javahow to replace a character 22 2c 22 in a string in javajava string replace 28 29replace all char in string javareplacing a character in a string in javastring java replacejava replace 5eareplace java charactersjava replace exluding charjava replace characters stringshow to rewrite a string in javajava string char replacereplace certain ccharector with another javareplace characters string javastring replace 28 29 javahow to change the value of a string in javahow to rplace a charecter in string in javajava strig replacejava replace 28 29how to change string in char javareplace something in string javahow to do replace with a string in javareplace a word in string javachar replacejava program to replace a character in a stringhow replace method works in javajava replace substringreplacing a specific value in a string javajava replace in stringjava replace word in stringreplace 23 from string in javahow to change string in javas replace javahow to replace one character in a string in javareplace values in string in javajava replace parts of string with stringjava string substitutionjava replace 3fhow to change the value of character in string in javahow to replace character in stirng javachange string char in java how to replace string with another in javajava replacing characterjava replace a character in a string at an indexjava replace 2cjava replace 26replace a char of a string with another charreplace char in words in javareplace en javahow to replace strings in javajava replace 5ehow to change characters in a string javahow to change the characters of a string in javareplace method in string javastr replace javareplace in string javareplace characters in stringhow to replace specific character from string in javajaav replace functionreplace substring with another string in a stringjquery string replacereplace fun in javastring replace 5c java java replace 28 29java change a char letter with anotherhow to substitute characters in a string in javarepalce a char in a string javahow to replace a character in a string in java without using replace method replace 28 29 javajava string replace replacehow to replace characters of string in javajava replace charactersjava string replace valuesstring replacehow to replace characetrs in javajava replace 3f charectoerjava string format replace character with 21change character of a string in javasubstitute character code javareplace in java replace symbol in string javareplace char of a stringreplace function in javamodify characters in string javachange a character in string javahow to replace the string of 2a 2a 2a in javajava replace a stringreplace method javahow to change the text in a string javareplace substring in java stringreplace a character in a stringjavareplacing character in stringjavajava replace a single character in stringreplace char with other javareplace string javajava string replace 22 5d 22replace string value with others javareplace a string on condition using javastring how to change character in javareplace 5e in javareplace characters from the stringsstring replace java used replace with a veraible javachange character in java stringhow to replace a single character in a string in javajava find and replace character in stringjava repalce stringjava 2b string replacehow to replace to 3a in javareplace method for string in javareplace a char with another javareplace ch in string javahow to rename string class javajava replace characters in a string with another stringreplace and contains javareplacement in java stringhwo to change character in stinr gjavareplace in a stringhow to replace character in stringhow to replace 2b string javareplace a substring java replace character at ith index in string javachanging characters in a string javastring replace some caracters javareplace full stringwith anther string replace with in javareplace 5c 5c 3a from string javareplace string java onlinereplace 22 with 27 in javareplace metod in javachange the string in javahow to replace substrings in strings javareplace 3f in java 5c to str replace in javastring builder how to replace a characte with another character in javajava replace characterhwo to replace a single character out of a string in javahow to replace string 2b to operator in javajava string replacehow to replace in javastring replace character javaprogram to replace a substring in a string in javareplce character in string javajava replace charsequencejava replace the 22 5c 22 in a stringreplace 5b in string javajava builtin replacechange place on a character in string javareplace character in java stringhow to replace 7b 7d javareplace 22 in string javareplace funtion in java for stringreplace method is used in javareplace character at index in string javajava replace whole stringjava replace one char in stringreplace in jaahow to replace character at particular index in javahow to replace charracters in a string java replace 28 29 in javareplace a char from an stringjava replace part of stringrepalce in javajava replace stringdeleting characters from a string and adding it to a new one javahow to change the character of a string in java 27 27 replacing with 2f in javareplacing in stringsreplace 2f with 5c in javachar replace in javajava replace codehow can we replace character in java stringsjava replace 2areplace a particular character in a string javachange char insude string javajava string modify characterstring replace java string to charsjava string replacehow to repalce certain symbols in a string javajava replace 22 in stringreplace chars in string javareplace the character in a string in javahow to replace a specific character in a string in javahow to replace 27 5c 27in stringjava replace in stringreplace char in string index javajava string replace charreplace char in javahow to replace 5b in javahow to replace a character with 22 22 in javareplace 7b 7d javausing replace in a string in javastr replace 28 29 javahow to replace char in string in javahow to replace letters in a string javastring replace in javaexample of replace in javastring replace character at index javahow do you replace a character in a string in java 3fhow to set a character in a string in javajava string replace characterjava string replace string likereplace char in stringhow to change string characters javajava how to replace char in stringcharacter replace javahow to replaca a letter with a letter javajava string replace at charchar replace charstring replaceall javareplace with in javareplace 22 29 22 javastring replace javachange character string javastring replace method in javareplace in java for stringjava replace 7b 7d in stringreplace java strinfwhere can i use replace in javachange character in a string in javastring replace substring javachange a character in a string in javawhat is replace method in javajava 7b 7d replacestring replace javahow to replace a string with another string inside a string in javachange character of a string javareplace string in javahow to replace a charater in javahow to replace 22 5c 22 in javareplace character in string in javareplace string with another string javareplace method javasreplace a character in a stringreplace a char in a string in javareplace string javareplace string in javahow to use replace in java for stringstring replcae javareplace methods in javareplace a char at an index in string javahow to replace on a string javareplace a char from a string javareplace string with another string in javahow to replace with 2f in javahow to replace a char in a string javareplace in java examplesstring replace char javajava change a character in stringhow to change a char in string javamove characters in string javastr replace javasstring replace java that replaces with stringhow to replace a string in javajava search a string array and replacehow do i replace a method in javahow to replace 22 in javahow to replaceall characters to another set of characcters in javareplace 28 22 2f 22 2c 22 22 29 character in string javareplace character in string with string in javareplace string with symbolstring character replace in java 40replace javareplace character string javashow to replace words in a string javajava replace a string with another string 2a replace 28 22 5c 22 2c 22 22 29 3b javastring replace java questionsstring replace a character javahow to change a character in string in java change string character javajava replace substring in stringhow to update a character in a string in javahow to replace a particular character in a string in javajava string replacejava replace 5ereplace contains string javareplace 22 in string in javareplace characters in string javareplace char with another char javareplace a string with another stringreplace things in strings javahow to replace a string in javareplace a char in stringreplace javahow to replace a character in a string in javareplace a char in a string with another javahow to replace 5c from string in javajava replacefile with stringjava replace specific characterreplace character from string in javajava replaceallreplace character with 40 in javajava replace 22replace string meathod java formatreplace strings in javareplace any charcter in string javaclass that implement string replacement in javajava string replace stringstring replace 22 in javareplace 28char 2c string 29 javajava str replace stringhow to replace a letter at specific place in a string javareplace certain ccharector with another java in stringstring modify a certain caracter javajava string change characterreplace in a string javahow to replace some character to an another character in javareplace a char with a stringstring handling method 28replace 29 in javahow to replace the 2a char in string replace all javahow to get the replcce charecter of a string in javccajava replace only one character in a stringjava replacereplace 3ca 3e stringhow to replace 5c char in string javahow to replace a letter with another in java stringstr replace javajava string replace character with stringreplacing the characters of a string javareplace a character from a stringreplace string injavahow to find and replace a character in a string in javareplace caharcter in string 5chow to replace a character of a string in java replace specific characters with new characters javajava string replace a substring string replace 28char 2c char 29how replace works in javareplace character in striung javajava replace characters in a stringreplace a char in string javastring replace javasreplace 5c string javareplace a string in javajava replace with stringjava how replace 27how to replace a chracter in a string javareplace parathesis in a string using replace in javareplace text javareplace instring javahow to replace a string with another stringjava does string replace copy replace in javastring replacement javastring replace mthod javareplace a character from string in javareplace char string javastr reaplce 28 27e 27 2c 272 27 29 3b in javareplace letter in strning javahow to replace the value in javareplace a character in string javreplace string element javajava replace variables in stringusing a for loop to replace a character in a string javareplacing a string in javareplace java examplesreplace a string javajava replacereplace text in javajava replace something from a charhow replace char in stringreplace the charcater in a stringjava string replace string with anotherhow to replace a single character in a string javajava substitute characters in stringeasy way to replace a part of a string with a char in javareplace string characterreplace 28 29 in javachange a char in a string javareplace 7b in javahow does the replacall function work in javajava replace printlnstring replace in javajava replace all instance of one character with a different character in a stringjava string replace a charreplace s in string javajava to replace stringjava find replace in stringreplace injava i 3dfor stringsreplace 3f from string in javahow to replace characetrs with others in javareplace method injacahow to change character of a string in javareplace in string in javause if method to change character in string javahow to replace a string with another string in javareplace chacter in string javarepplace string char with another string character javafunction of replace string in java 5d 5dreplace all of a certain ccharector with another java in stringhw to replace lettes in string with characters in javahow to replace chars in string javareplace from to javajava substring replacereplace 1 char in string javachar replace in stringhow to get replace characters of string in javahow to replace letters in a string in javaprogram to replace some character in string javahow to change the string methodchar replace javareplacing things in strings javafind and replace string in javajava replace methodjava replacereplace char in string java mrthod 5cstring replase in javahow to use replace character in string javajava change char in stringhow to replace char in a string by index javajava how to replace stringjava string replace methodsjava regex replacehow to replace a word in a string in java using replace methodreplace text javashow to replace 22 7b 7d 22 javastring char replace in javahow to replace acharacter in a stringjava replace 26 by c2 a7java strong replacereplace string with another stringjava string replace importreplace a character in a string javareplace 22 5c 22 javarepace text in javajava replace string with another stringreplace a char in javahow to substitute string javahow to replace characters in a javajava replace a characterreplace chars string replace javareplace characters in a string in javastring replace javjava replace 25sreplace 22 28 29 22 in javahow to set a character in a string with another character javadifferent ways to change string in javareplace in string javahow to replace char in sstringhow to replace string cords in javajava program to replace occurrences of specific char in a stringstring java method to replaceprogramming in java typing letter replaces old letterstr replace 28 29 in javareplace function jaareplace javsstring change characters javajava replace charstring replace jaasubstitute a character in string javahow to over write a given string in javahow to change a char of a string in javachange characters of a string javahow to use replace javajava replace helpstring replace characterjava how to replace a character in a stringhow to replace a character with a string in a string in javareplace megthod in java replace javajava change character in stringwrite a java program to find a character from a sentence and replace it with another character java message replacerjava replace something from a stringhow to replace javareplace characters ins tringhow to replace 24 in javajava string replace 5dreplace string method in javareplace a substring in a string in javareplace with string java 40 replace javareplace 2f to in stringreplace method in strings in javahow to replace a chacter in stringchar in a string replace in javareplace char in a string method in javareplace java 27how to replace characters in a string in javajava replace 2c by in stringreplace matched text javahow to replace a int character in a string in javareplace char in string in javahow to use replace functionin javajava string how to replace a characterchanging a character in a string javajava replace char in stringwrite a java program to replace certain characters from string replace with in javastring replace java use orstring contains and replace in javahow to use string replace in javastring replace character in javareplace char string in javahow to change a string javahwo to change cahracter in text in javahow to repace stringreplace all characters with 2a javahow to change a character in a string javareplaceall character in string javastring replce in javafind and replace in java string programjava string replace substring examplehow to replace a character in javareplace characters in javajava how to change letters in a stringreplace stringreplace working javastr reaplce 28 27e 27 2c 272 27 29 3b in java with numerreplace a character in a string in javareplace certain chars in string javareplace 5c 22 with 22 in javareplace in javastring replace charreplace funtion javastring replace fiunction in javastring replace in java 25sjava replace letter in stringhow to use replace in javahow to substitute characters at index in a string in javajava replace up to certain characters from stringreplacing characters in a sentence javareplace 3a from strgin javamethod string to replace javajava string replace char in stringreplace character in a stringhow to replace char in a string javajava replace examplehow to change character in a string in javastring character replace javacharacters replace in javareplace char with another javareplace character in string java at indexstrng replace javareplace a char in a word javareplace a character from a string javareplace and 22 28 22 in javastring replace method in javareplace specific character in string javajava string replacehow to replace a char in a string javsubstitute string javareplacing data in strng in javajava string replace 5creplace a character at a particular index in string javause string replace in javahow to replace at specific character in string in javareplace 22 javajava replace a character in a stringreplace a character with 5c javareplace characters on stringjavajava replace pattern in stringhow to replace part of string in javareplace 5btext 5d with string in javajava code to replace characters in a stringhow to read character of strings and replace it in javareplace with different arguments in javamethod to replace a string in javahow to replace a character in a string with another string in javafind and replace in javareplace to 2f in javareplace in java stringsubstring replace string javahow to replace a character from a stringreplace java stringjava method to replace a string in stringjava replace a single char in a stringreplace in java which packagejava replace methondshow to replace value in string javareplace in java works 3freplace letters in a string javajava replace set of characters in stringjava text replacejava how to change a character of a stringjava string replace cahracterjava replace 5c 60replace substring in a string in javareplace character in strng javapattern replace java stringhow to use replace function in javajava replace character