Muszę zastąpić ciąg zawierający białe spacje i kropki. Próbowałem z następującego kodu:Jak zamienić ciąg w java zawierający kropkę?
String customerName = "Mr. Raj Kumar";
customerName = customerName.replaceAll(" ", "");
System.out.println("customerName"+customerName);
customerName = customerName.replaceAll(".", "");
System.out.println("customerName"+customerName);
ale skutkuje to:
CustomerName Mr.RajKumar
I
CustomerName
Otrzymuję poprawną nazwę klienta od pierwszego SPO, ale z drugiego SPO nie otrzymuję żadnej wartości.
Escape the dot z odwrotnym ukośnikiem: '\ .' – martijno