Including numbers, but not spaces:
"Stack Me 123 Heppa1 oeu".replaceAll("\\W","").toCharArray();
=> S, t, a, c, k, M, e, 1, 2, 3, H, e, p, p, a, 1, o, e, u
Without numbers and spaces:
"Stack Me 123 Heppa1 oeu".replaceAll("[^az^AZ]","").toCharArray()
=> S, t, a, c, k, M, e, H, e, p, p, a, o, e, u
p3t0r 05 Oct '09 at 19:45 2009-10-05 19:45
source share