Advertisement
Guest User

FilterString

a guest
Feb 21st, 2020
207
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.55 KB | None | 0 0
  1. public static void words(String n) {
  2.         int num = 0;
  3.         String x[] = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"};
  4.         for (int i = 0; i < n.length(); i++) {
  5.             for (int j = 0; j < x.length; j++)
  6.                 if (String.valueOf(n.charAt(i)).equals(x[j])) {
  7.                     String words = n.substring(num , i);
  8.                     System.out.print(words);
  9.                     num = i+1;
  10.                 }
  11.             // string n = "BASSAM222WWW12341KMKMKM999"
  12.             // Result = BASSAMWWWKMKMKM
  13.         }
  14.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement