+ 1
How can i convert numbers into symbols of this "-"? Ex. Abcd123 it will become abcd---
2 Respostas
+ 5
import java.util.Scanner;
public class Program
{
public static void main(String[] args) {
String s = new Scanner(System.in).nextLine();
for(int i = 0;i<s.length();i++)
{
if(s.charAt(i) >= '0' && s.charAt(i) <= '9')
{
System.out.print("-");
}
else
System.out.print(s.charAt(i));
}
}
}
0
how can i insert that code using a file input stream.. we can read the input inside the file then read it with replacing numbers into '-' ?