AlgoBox { public static String first_Char_EW(String sInput) { if (sInput == null || "".equals(sInput)) { return ""; } StringBuilder sb = new StringBuilder(); StringTokenizer tok = new StringTokenizer(sInput); while (tok.hasMoreTokens()) { String word = tok.nextToken(); sb.append(word.substring(0, word.offsetByCodePoints(0, 1))); } 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_Char_EW() { assertEquals(BLANK_STR, AlgoBox.first_Char_EW(null)); assertEquals("t", AlgoBox.first_Char_EW(TEST_STR)); assertEquals(BLANK_STR, AlgoBox.first_Char_EW(BLANK_STR)); assertEquals("n", AlgoBox.first_Char_EW(NULL_STR)); assertEquals(QUO_STR, AlgoBox.first_Char_EW(QUO_STR)); assertEquals("拓", AlgoBox.first_Char_EW("拓蓝科技")); assertEquals("𠀀", AlgoBox.first_Char_EW(MIXTD_SURROGATEPAIR)); assertEquals("リ", AlgoBox.first_Char_EW(JAPANESE1_STR)); assertEquals("リ", AlgoBox.first_Char_EW(JAPANESE2_STR)); assertEquals("リを食", AlgoBox.first_Char_EW(JAPANESE3_STR)); }