Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package Test;
- import java.io.*;
- public class StringContains {
- private static String input;
- public static void main( String args[] ) throws IOException {
- BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
- while ( !(input = br.readLine()).isEmpty() ) {
- System.out.println("Alpha only = " + input.replaceAll("\\d", "").replaceAll("\\W", "").replaceAll("\\s", ""));
- System.out.println("Numberic only = " + input.replaceAll("\\D", ""));
- System.out.println("Symbols only = " + input.replaceAll("\\w", ""));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment