This patch adds a new StringUtils method which converts the first letter
of a string to lowercase.
- robert
Index: src/java/org/apache/velocity/util/StringUtils.java
===================================================================
RCS file:
/home/cvs/jakarta-velocity/src/java/org/apache/velocity/util/StringUtils.java,v
retrieving revision 1.13
diff -u -r1.13 StringUtils.java
--- src/java/org/apache/velocity/util/StringUtils.java 2001/07/02 03:16:01 1.13
+++ src/java/org/apache/velocity/util/StringUtils.java 2001/08/22 18:26:47
@@ -244,6 +244,26 @@
return firstLetter + restLetters;
}
+
+ /**
+ * <p>
+ * Convert the first letter to lowercase.
+ * </p>
+ *
+ * <p>
+ * For example <code>FooBar</code> becomes <code>fooBar</code>.
+ * </p>
+ *
+ * @param data string to be lowercased
+ * @return string with the first letter lowercased
+ */
+ public String lowercaseFirstLetter ( String data )
+ {
+ String firstLetter = data.substring(0,1).toLowerCase();
+ String restLetters = data.substring(1);
+ return firstLetter + restLetters;
+ }
+
/**
* Create a string array from a string separated by delim
*