Fix bug in humaniseCamelCase.

This commit is contained in:
halfdan committed 2014-11-07 21:59:28 +01:00
1 parent 7605dacb8a
commit 1dedb13dc9
2 files changed
+3 -1

No files matched your search

+1 -1
View File
@@ -399,7 +399,7 @@ public final class StringTools {
* @return Readable String representation of input word * @return Readable String representation of input word
*/ */
public static String humaniseCamelCase(final String word) { public static String humaniseCamelCase(final String word) {
Pattern pattern = Pattern.compile("([A-Z]|[a-z])[a-z]*"); Pattern pattern = Pattern.compile("([A-Z]|[a-z])[a-z0-9]*");
List<String> tokens = new ArrayList<>(); List<String> tokens = new ArrayList<>();
Matcher matcher = pattern.matcher(word); Matcher matcher = pattern.matcher(word);
+2
View File
@@ -37,6 +37,8 @@ public class StringToolsTest {
map.put("thisIsAwesome", "This Is Awesome"); map.put("thisIsAwesome", "This Is Awesome");
map.put("THQIsNice", "THQ Is Nice"); map.put("THQIsNice", "THQ Is Nice");
map.put("iLikeABC", "I Like ABC"); map.put("iLikeABC", "I Like ABC");
map.put("foo2Bar", "Foo2 Bar");
map.put("phi1", "Phi1");
String key, value; String key, value;
for (Object o : map.entrySet()) { for (Object o : map.entrySet()) {