0
Need help here.
How do you remove the duplicate result showing from the output?? here is my code : System.out.println("Enter letters only"); String alpha = scan.nextLine(); String numb = "[0-9]"; if(alpha.matches("[a-zA-Z]")) { System.out.println(alpha); }else System.out.println(alpha.replaceAll(numb , " not a letter")); } } INPUT qwerty123 OUTPUT qwerty not a letter not a letter not a letter I want it to be ( qwerty not a letter ).
4 odpowiedzi
+ 3
Zeyah Why you don't write like this.
System.out.println(alpha.replaceAll(numb, "") + " not a letter");
0
intenta con
replace(numb,"not a letter")
0
thank you very much for your help 😄
0
ooops the (not a letter) is showing even I input alphabets only but thanks thoo😂