X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Futil%2FStringUtils.java;h=0b0dee076067ce3badfe68490e2e80e32712793c;hb=d9c7868a610eff29a8eddb160b6dc78a94a72470;hp=1c9d7b7a493a7ec1606262c13fc80077cf94722a;hpb=1c6ddae580d69eb0fa5b4291ba84fd6ba9b83621;p=jalview.git diff --git a/src/jalview/util/StringUtils.java b/src/jalview/util/StringUtils.java index 1c9d7b7..0b0dee0 100644 --- a/src/jalview/util/StringUtils.java +++ b/src/jalview/util/StringUtils.java @@ -1,6 +1,6 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) - * Copyright (C) $$Year-Rel$$ The Jalview Authors + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9.0b2) + * Copyright (C) 2015 The Jalview Authors * * This file is part of Jalview. * @@ -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(); + } }