code: public static int getStringCase(String str) {
          if (str.length() == 0) {
              return MIXED;
          }
  
          int state = -1;
  
          char ch = str.charAt(0);
          if (Character.isLetter(ch)) {
              if (Character.isUpperCase(ch)) {
                  state = UPPER_CASE;
              } else {
                  state = LOWER_CASE;
              }
          }
  
          for (int i = 1; i < str.length(); i++) {
              ch = str.charAt(i);
              if (!Character.isLetter(ch)) {
                  continue;
              }
  
              switch (state) {
                  case UPPER_CASE:
                      if (Character.isLowerCase(ch)) {
                          if (i == 1) {
                              state = TITLE_CASE;
                          } else {
                              return MIXED;
                          }
                      }
                      break;
                  case LOWER_CASE:
                  case TITLE_CASE:
                      if (Character.isUpperCase(ch)) {
                          return MIXED;
                      }
                      break;
              }
          }
  
          return state;
      }
docs: Returns if the specified string is all upper case, all lower case,
  or title case (first letter upper case, rest lower case).
  
  @param str The string
  @since jEdit 4.0pre1