@Test public void testTrimByCamelCase() { Assert.assertEquals("CommitteVirtMemSize", nameCutter.trimByCamelCase("CommittedVirtMemSize", 19)); Assert.assertEquals("CommiVirtuMemorSize", nameCutter.trimByCamelCase("CommittedVirtualMemorySize", 19)); Assert.assertEquals("AllIdentTokeniCount", nameCutter.trimByCamelCase("AllIdentityTokenizedCount", 19)); }
public String trimByCamelCase(String name, Integer maxLength) { String result = ""; String[] nameParts = StringUtils.splitByCharacterTypeCamelCase(name); Integer charsOver = name.length() - maxLength; for (int i = 0; i < charsOver; i++) { Integer largest = 0; Integer index = 0; for (int j = 0; j < nameParts.length; j++) { if (nameParts[j].length() > largest) { largest = nameParts[j].length(); index = j; } } nameParts[index] = StringUtils.chop(nameParts[index]); } for (String namePart : nameParts) { result = result + namePart; } return result; }
NameCutter { public String trimByCamelCase(String name, Integer maxLength) { String result = ""; String[] nameParts = StringUtils.splitByCharacterTypeCamelCase(name); Integer charsOver = name.length() - maxLength; for (int i = 0; i < charsOver; i++) { Integer largest = 0; Integer index = 0; for (int j = 0; j < nameParts.length; j++) { if (nameParts[j].length() > largest) { largest = nameParts[j].length(); index = j; } } nameParts[index] = StringUtils.chop(nameParts[index]); } for (String namePart : nameParts) { result = result + namePart; } return result; } }
NameCutter { public String trimByCamelCase(String name, Integer maxLength) { String result = ""; String[] nameParts = StringUtils.splitByCharacterTypeCamelCase(name); Integer charsOver = name.length() - maxLength; for (int i = 0; i < charsOver; i++) { Integer largest = 0; Integer index = 0; for (int j = 0; j < nameParts.length; j++) { if (nameParts[j].length() > largest) { largest = nameParts[j].length(); index = j; } } nameParts[index] = StringUtils.chop(nameParts[index]); } for (String namePart : nameParts) { result = result + namePart; } return result; }  }
NameCutter { public String trimByCamelCase(String name, Integer maxLength) { String result = ""; String[] nameParts = StringUtils.splitByCharacterTypeCamelCase(name); Integer charsOver = name.length() - maxLength; for (int i = 0; i < charsOver; i++) { Integer largest = 0; Integer index = 0; for (int j = 0; j < nameParts.length; j++) { if (nameParts[j].length() > largest) { largest = nameParts[j].length(); index = j; } } nameParts[index] = StringUtils.chop(nameParts[index]); } for (String namePart : nameParts) { result = result + namePart; } return result; }  String trimByCamelCase(String name, Integer maxLength); String trimByDictionary(String name); Map<String, String> getDictionary(); void setDictionary(Map<String, String> dictionary); }
NameCutter { public String trimByCamelCase(String name, Integer maxLength) { String result = ""; String[] nameParts = StringUtils.splitByCharacterTypeCamelCase(name); Integer charsOver = name.length() - maxLength; for (int i = 0; i < charsOver; i++) { Integer largest = 0; Integer index = 0; for (int j = 0; j < nameParts.length; j++) { if (nameParts[j].length() > largest) { largest = nameParts[j].length(); index = j; } } nameParts[index] = StringUtils.chop(nameParts[index]); } for (String namePart : nameParts) { result = result + namePart; } return result; }  String trimByCamelCase(String name, Integer maxLength); String trimByDictionary(String name); Map<String, String> getDictionary(); void setDictionary(Map<String, String> dictionary);  }