Hi Grzegorz, Could you open a JIRA issue for the idea and attach a patch file?
We're really close to releasing 2.4, so I'm not sure if it would go in there or not. There was also a ticket about camel case in 2.4 that you might want to look at: https://issues.apache.org/jira/browse/LANG-192 Matt ended up adding a method; possibly that might help you or might be something you disagree with. Thanks, Hen On Sun, Mar 2, 2008 at 9:58 AM, Grzegorz Błaszczyk <[EMAIL PROTECTED]> wrote: > Hello, > > I would like to add two new static methods for handling camel scape and > underscore separated strings to org.apache.commons.lang.StringUtils > class. Please give me a hand how to add it to the repository (commit to > some branch or something) without breaking anything else (code below). > > Grzegorz Blaszczyk > > > public static String camelCaseToUnderscoreSeparated(String name, > boolean toLowerCase) { > StringBuilder s = new StringBuilder(); > if (name == null) { > return ""; > } > int length = name.length(); > for (int i = 0; i < length; i++) { > char ch = name.charAt(i); > if (Character.isUpperCase(ch) && i > 0) { > s.append("_"); > } > if (ch == '.') { > s.append("_"); > } else { > s.append(toLowerCase ? > Character.toLowerCase(ch) : Character > .toUpperCase(ch)); > } > } > return s.toString(); > } > > public static String underscoreSeparatedToCamelCase(String name) { > StringBuilder s = new StringBuilder(); > if (name == null) { > return ""; > } > int length = name.length(); > boolean upperCase = false; > > for (int i = 0; i < length; i++) { > char ch = name.charAt(i); > if (ch == '_') { > upperCase = true; > } else if (upperCase) { > s.append(Character.toUpperCase(ch)); > upperCase = false; > } else { > s.append(ch); > } > } > return s.toString(); > } > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > >