Programming Tips - How can I write an ispunct() in Java?

Date: 2012may23 Language: Java Q. How can I write an ispunct() in Java? A. Here's one way:
boolean isPunct(final char c) { final int val = (int)c; return val >= 33 && val <= 47 || val >= 58 && val <= 64 || val >= 91 && val <= 96 || val >= 123 && val <= 126; // We could use Character.getType() but I don't really trust it. // This is simple and works for ASCII values. // Of course this does not work work for international characters. }
More info http://man-ascii.com