diff options
author | Shawn Pearce <spearce@spearce.org> | 2015-03-11 13:27:16 -0400 |
---|---|---|
committer | Gerrit Code Review @ Eclipse.org <gerrit@eclipse.org> | 2015-03-11 13:27:18 -0400 |
commit | d1bda470d447905c9425e5c9e86f3d9e90e1bf6b (patch) | |
tree | d8b4dbf3a446ef706e0c78e7273992859927afc4 /org.eclipse.jgit/src/org/eclipse/jgit/util | |
parent | 0f51246b0e99e3ef5ffc7056221dff6034214ad7 (diff) | |
parent | c0c4c6f09ac1d601a5d9fe9855e36e4b96b10335 (diff) | |
download | jgit-d1bda470d447905c9425e5c9e86f3d9e90e1bf6b.tar.gz jgit-d1bda470d447905c9425e5c9e86f3d9e90e1bf6b.zip |
Merge "ArchiveCommand: Allow to pass options to underlying stream"
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/util')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/util/StringUtils.java | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/util/StringUtils.java b/org.eclipse.jgit/src/org/eclipse/jgit/util/StringUtils.java index 40b89fba9b..1fd5089300 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/util/StringUtils.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/util/StringUtils.java @@ -96,6 +96,31 @@ public final class StringUtils { return r.toString(); } + + /** + * Borrowed from commons-lang <code>StringUtils.capitalize()</code> method. + * + * <p> + * Capitalizes a String changing the first letter to title case as per + * {@link Character#toTitleCase(char)}. No other letters are changed. + * </p> + * + * A <code>null</code> input String returns <code>null</code>.</p> + * + * @param str + * the String to capitalize, may be null + * @return the capitalized String, <code>null</code> if null String input + */ + public static String capitalize(String str) { + int strLen; + if (str == null || (strLen = str.length()) == 0) { + return str; + } + return new StringBuffer(strLen) + .append(Character.toTitleCase(str.charAt(0))) + .append(str.substring(1)).toString(); + } + /** * Test if two strings are equal, ignoring case. * <p> |