code: public static String toTitleCase(String str) {
          if (str.length() == 0) {
              return str;
          } else {
              return Character.toUpperCase(str.charAt(0)) + str.substring(1).toLowerCase();
          }
      }
docs: Converts the specified string to title case, by capitalizing the
  first letter.
  
  @param str The string
  @since jEdit 4.0pre1