regex - Insert a space after every given character - java -
I need to insert a location after a given character in the string.
For example "Abc.def ..."
need to be created "abc def ..."
Then given in this case
My search on Google did not answer that question
I really need to get some serious reggae knowledge.
Edit: ---------------------------------------- ---------- -------
string testing = "0:; 1:;"; Test.replaceAll ("\\:", "::" "); Println (test); // Output: 0 :; 1:: // Not done anything
Solution: ------------------------------- ------------------- -----
string testing = "0:; 1:; "; ** test = ** test.replaceAll (" \\: ",": "); Println (test);
You can use:
string input = "abc.def ..."; string result = input.replaceAll (" \\. ",". "); // Results" abc. Def ".
Edit:
string testing =" 0:; 1:; "; Results = test.replaceAll (": ",": "); // The result will be" 0:; 1:; "(Testing is still unmodified)
Edit:
As stated in the other answer, String.replace () < / Code> All you need is a simple replacement only if it is a regular expression (as you said in your question), then you have to use
String.replaceAll ()
.
Comments
Post a Comment