fork(2) download
  1. import java.util.regex.Pattern;
  2.  
  3. class Main
  4. {
  5. public static void main (String[] args) throws java.lang.Exception
  6. {
  7. String test = "abcd1234 \u0030-\u0039\u0660-\u0669\u06f0-\u06f9\u07c0-\u07c9\u0966-\u096f\u09e6-\u09ef\u0a66-\u0a6f\u0ae6-\u0aef\u0b66-\u0b6f\u0be6-\u0bef\u0c66-\u0c6f\u0ce6-\u0cef\u0d66-\u0d6f\u0e50-\u0e59\u0ed0-\u0ed9\u0f20-\u0f29\u1040-\u1049\u17e0-\u17e9\u1810-\u1819\u1946-\u194f\u19d0-\u19d9\u1b50-\u1b59\uff10-\uff19";
  8. for ( int i = 0 ; i < test.length() ; i++ ) {
  9. System.out.print("Character: " + test.charAt(i) + " - isDigit: " + Character.isDigit(test.charAt(i)));
  10. System.out.println("; Pattern: " + Pattern.matches("\\p{Nd}", test.substring(i,i+1)));
  11. if ( Character.isDigit(test.charAt(i)) != Pattern.matches("\\p{Nd}", test.substring(i,i+1)) )
  12. System.out.println("[ERROR: different results!]");
  13. }
  14. }
  15. }
  16.  
Success #stdin #stdout 0.08s 380544KB
stdin
Standard input is empty
stdout
Character: a - isDigit: false; Pattern: false
Character: b - isDigit: false; Pattern: false
Character: c - isDigit: false; Pattern: false
Character: d - isDigit: false; Pattern: false
Character: 1 - isDigit: true; Pattern: true
Character: 2 - isDigit: true; Pattern: true
Character: 3 - isDigit: true; Pattern: true
Character: 4 - isDigit: true; Pattern: true
Character:   - isDigit: false; Pattern: false
Character: 0 - isDigit: true; Pattern: true
Character: - - isDigit: false; Pattern: false
Character: 9 - isDigit: true; Pattern: true
Character: ٠ - isDigit: true; Pattern: true
Character: - - isDigit: false; Pattern: false
Character: ٩ - isDigit: true; Pattern: true
Character: ۰ - isDigit: true; Pattern: true
Character: - - isDigit: false; Pattern: false
Character: ۹ - isDigit: true; Pattern: true
Character: ߀ - isDigit: true; Pattern: true
Character: - - isDigit: false; Pattern: false
Character: ߉ - isDigit: true; Pattern: true
Character: ० - isDigit: true; Pattern: true
Character: - - isDigit: false; Pattern: false
Character: ९ - isDigit: true; Pattern: true
Character: ০ - isDigit: true; Pattern: true
Character: - - isDigit: false; Pattern: false
Character: ৯ - isDigit: true; Pattern: true
Character: ੦ - isDigit: true; Pattern: true
Character: - - isDigit: false; Pattern: false
Character: ੯ - isDigit: true; Pattern: true
Character: ૦ - isDigit: true; Pattern: true
Character: - - isDigit: false; Pattern: false
Character: ૯ - isDigit: true; Pattern: true
Character: ୦ - isDigit: true; Pattern: true
Character: - - isDigit: false; Pattern: false
Character: ୯ - isDigit: true; Pattern: true
Character: ௦ - isDigit: true; Pattern: true
Character: - - isDigit: false; Pattern: false
Character: ௯ - isDigit: true; Pattern: true
Character: ౦ - isDigit: true; Pattern: true
Character: - - isDigit: false; Pattern: false
Character: ౯ - isDigit: true; Pattern: true
Character: ೦ - isDigit: true; Pattern: true
Character: - - isDigit: false; Pattern: false
Character: ೯ - isDigit: true; Pattern: true
Character: ൦ - isDigit: true; Pattern: true
Character: - - isDigit: false; Pattern: false
Character: ൯ - isDigit: true; Pattern: true
Character: ๐ - isDigit: true; Pattern: true
Character: - - isDigit: false; Pattern: false
Character: ๙ - isDigit: true; Pattern: true
Character: ໐ - isDigit: true; Pattern: true
Character: - - isDigit: false; Pattern: false
Character: ໙ - isDigit: true; Pattern: true
Character: ༠ - isDigit: true; Pattern: true
Character: - - isDigit: false; Pattern: false
Character: ༩ - isDigit: true; Pattern: true
Character: ၀ - isDigit: true; Pattern: true
Character: - - isDigit: false; Pattern: false
Character: ၉ - isDigit: true; Pattern: true
Character: ០ - isDigit: true; Pattern: true
Character: - - isDigit: false; Pattern: false
Character: ៩ - isDigit: true; Pattern: true
Character: ᠐ - isDigit: true; Pattern: true
Character: - - isDigit: false; Pattern: false
Character: ᠙ - isDigit: true; Pattern: true
Character: ᥆ - isDigit: true; Pattern: true
Character: - - isDigit: false; Pattern: false
Character: ᥏ - isDigit: true; Pattern: true
Character: ᧐ - isDigit: true; Pattern: true
Character: - - isDigit: false; Pattern: false
Character: ᧙ - isDigit: true; Pattern: true
Character: ᭐ - isDigit: true; Pattern: true
Character: - - isDigit: false; Pattern: false
Character: ᭙ - isDigit: true; Pattern: true
Character: 0 - isDigit: true; Pattern: true
Character: - - isDigit: false; Pattern: false
Character: 9 - isDigit: true; Pattern: true