I have a string "ABC DEF" and I would like to add "\s" in between the words to make it "ABC\sDEF" for XPath matches.
String label = "ABC DEF";
String[] arrLabel = label.split("\\s+");
String matches = "\\s";
label=arrLabel[0];
for(int i = 1; i < arrLabel.length; i++){
label = label + matches + arrLabel[i];
System.out.println("label = " + label);
}
But I keep getting label printed as ABC\\sDEF
.
I really want it to be ABC\sDEF
.
How should I go about doing this ?