io.ebeaninternal.dbmigration.ddlgeneration.platform.util.VowelRemover Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ebean Show documentation
Show all versions of ebean Show documentation
composite of common runtime dependencies for all platforms
package io.ebeaninternal.dbmigration.ddlgeneration.platform.util;
/**
* Utility to remove vowels (from constraint names primarily for Oracle and DB2).
*/
public class VowelRemover {
/**
* Trim a word by removing vowels skipping some initial characters.
*/
public static String trim(String word, int skipChars) {
if (word.length() < skipChars) {
return word;
}
StringBuilder res = new StringBuilder();
res.append(word.substring(0, skipChars));
for (int i = skipChars; i < word.length(); i++) {
char ch = word.charAt(i);
if (!isVowel(ch)) {
res.append(ch);
}
}
return res.toString();
}
private static boolean isVowel(char ch) {
ch = Character.toLowerCase(ch);
return ch == 'a' || ch == 'e' || ch == 'i' || ch == 'o' || ch == 'u';
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy