Why do i get “AAAAAAAAA” instead of “1A234A567” from following Code:
String myst = "1.234.567";
String test = myst.replaceAll(".", "A");
System.out.println(test);
Any Idea?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
replaceAllfunction take a regular expression as parameter. And the regular expression “.” means “any character”. You have to escape it to specify that it is the character you want :replaceAll("\\.", "A")