@Test public void removeVowels() { assertThat(removeVowelsSmart("aeiouAEIOU", 10)).isEqualTo("aU"); assertThat(removeVowelsSmart("a1e2i3o4u5A6E7I8O9U", 10)).isEqualTo("a123456789U"); assertThat(removeVowelsSmart("", 10)).isEqualTo(""); assertThat(removeVowelsSmart("a", 10)).isEqualTo("a"); assertThat(removeVowelsSmart("ae", 10)).isEqualTo("ae"); assertThat(removeVowelsSmart("aeb", 10)).isEqualTo("ab"); assertThat(removeVowelsSmart("bae", 10)).isEqualTo("be"); assertThat(removeVowelsSmart("aebae", 10)).isEqualTo("abe"); assertThat(removeVowelsSmart("aeeb", 10)).isEqualTo("ab"); assertThat(removeVowelsSmart("friends", 10)).isEqualTo("frnds"); }
public static String removeVowelsSmart(String str, int maxCountToRemove) { StringBuilder result = new StringBuilder(str); int firstIndex = 1; int lastIndex = result.length() - 2; for (int i = lastIndex, removed = 0; i >= firstIndex && removed < maxCountToRemove; i--) { if (isVowel(result.charAt(i))) { result.deleteCharAt(i); removed++; } } return result.toString(); }
NamingStrategyUtils { public static String removeVowelsSmart(String str, int maxCountToRemove) { StringBuilder result = new StringBuilder(str); int firstIndex = 1; int lastIndex = result.length() - 2; for (int i = lastIndex, removed = 0; i >= firstIndex && removed < maxCountToRemove; i--) { if (isVowel(result.charAt(i))) { result.deleteCharAt(i); removed++; } } return result.toString(); } }
NamingStrategyUtils { public static String removeVowelsSmart(String str, int maxCountToRemove) { StringBuilder result = new StringBuilder(str); int firstIndex = 1; int lastIndex = result.length() - 2; for (int i = lastIndex, removed = 0; i >= firstIndex && removed < maxCountToRemove; i--) { if (isVowel(result.charAt(i))) { result.deleteCharAt(i); removed++; } } return result.toString(); } private  NamingStrategyUtils(); }
NamingStrategyUtils { public static String removeVowelsSmart(String str, int maxCountToRemove) { StringBuilder result = new StringBuilder(str); int firstIndex = 1; int lastIndex = result.length() - 2; for (int i = lastIndex, removed = 0; i >= firstIndex && removed < maxCountToRemove; i--) { if (isVowel(result.charAt(i))) { result.deleteCharAt(i); removed++; } } return result.toString(); } private  NamingStrategyUtils(); static String propertyToPluralizedName(String property); static String classToPluralizedName(String className); static String propertyToName(String property); static String classToName(String className); static String addUnderscores(String name); static String unqualifyEntityName(String entityName); static String unqualify(String qualifiedName); static String concat(String left, String right); static String concat(String[] parts); static String pluralize(final String name); static String removeVowelsSmart(String str, int maxCountToRemove); static boolean isVowel(char value); }
NamingStrategyUtils { public static String removeVowelsSmart(String str, int maxCountToRemove) { StringBuilder result = new StringBuilder(str); int firstIndex = 1; int lastIndex = result.length() - 2; for (int i = lastIndex, removed = 0; i >= firstIndex && removed < maxCountToRemove; i--) { if (isVowel(result.charAt(i))) { result.deleteCharAt(i); removed++; } } return result.toString(); } private  NamingStrategyUtils(); static String propertyToPluralizedName(String property); static String classToPluralizedName(String className); static String propertyToName(String property); static String classToName(String className); static String addUnderscores(String name); static String unqualifyEntityName(String entityName); static String unqualify(String qualifiedName); static String concat(String left, String right); static String concat(String[] parts); static String pluralize(final String name); static String removeVowelsSmart(String str, int maxCountToRemove); static boolean isVowel(char value); static final char NAME_PARTS_SEPARATOR; }