JAL-2089 patch broken merge to master for Release 2.10.0b1
[jalview.git] / src / jalview / util / StringUtils.java
index 1c9d7b7..b5ab40d 100644 (file)
@@ -248,7 +248,7 @@ public class StringUtils
     }
     return "" + separator;
   }
-  
+
   /**
    * Converts a list to a string with a delimiter before each term except the
    * first. Returns an empty string given a null or zero-length argument. This
@@ -383,4 +383,24 @@ public class StringUtils
      */
     return 0;
   }
+
+  /**
+   * Converts the string to all lower-case except the first character which is
+   * upper-cased
+   * 
+   * @param s
+   * @return
+   */
+  public static String toSentenceCase(String s)
+  {
+    if (s == null)
+    {
+      return s;
+    }
+    if (s.length() <= 1)
+    {
+      return s.toUpperCase();
+    }
+    return s.substring(0, 1).toUpperCase() + s.substring(1).toLowerCase();
+  }
 }