AlgoBox { public static String first_N_Vowels(String sInput, int nb) { if (sInput == null || "".equals(sInput.trim())) { return ""; } String d_pattern = "[aeiouAEIOU]"; StringBuilder sb = new StringBuilder(); int s_len = sInput.length(); String s; for (int i = 0; i < s_len; i++) { s = sInput.substring(i, i + 1); if (!" ".equals(s) && s.matches(d_pattern) && ((--nb) >= 0)) { sb.append(s); } } return sb.toString(); }  static void main(String[] args); static String pick_Char(String sInput, String pattern); static String first_N_Consonants(String sInput, int nb); static String first_N_Vowels(String sInput, int nb); static String subStr(String sInput, String pattern); static String first_N_Char(String sInput, int nb); static String last_N_Char(String sInput, int nb); static String first_N_Char_EW(String sInput, int nb); static String first_Char_EW(String sInput); static String soundex(String sInput); static String doublemetaphone(String sInput); static String metaphone(String sInput); static String add_Left_Char(String sInput, String position); static String add_Right_Char(String sInput, String position); static String removeDiacriticalMarks(String sInput); static String exact(String sInput); static String useDefault(String sInput, String insteadOf); static String lowerCase(String sInput); static String upperCase(String sInput); static String removeDMAndLowerCase(String sInput); static String removeDMAndUpperCase(String sInput); static String fingerPrintKey(String sInput); static String nGramKey(String sInput); static String colognePhonetic(String sInput);  }
@Test public void testFirst_N_Vowels() { assertEquals(BLANK_STR, AlgoBox.first_N_Vowels(null, 1)); assertEquals("e", AlgoBox.first_N_Vowels(TEST_STR, 2000)); assertEquals("e", AlgoBox.first_N_Vowels("test\ntest", 1)); assertEquals("ee", AlgoBox.first_N_Vowels("test\ttest", 2)); assertEquals("ee", AlgoBox.first_N_Vowels("test test", 5)); assertEquals(BLANK_STR, AlgoBox.first_N_Vowels(BLANK_STR, 1)); assertEquals(BLANK_STR, AlgoBox.first_N_Vowels(SPACE_STR, 1)); assertEquals("u", AlgoBox.first_N_Vowels(NULL_STR, 1)); assertEquals(BLANK_STR, AlgoBox.first_N_Vowels(QUO_STR, 1)); assertEquals(BLANK_STR, AlgoBox.first_N_Vowels(JAPANESE1_STR, 1)); }