📅  最后修改于: 2022-03-11 14:52:23.346000             🧑  作者: Mango
String someString = "elephant";
long count = someString.chars().filter(ch -> ch == 'e').count();
assertEquals(2, count);
long count2 = someString.codePoints().filter(ch -> ch == 'e').count();
assertEquals(2, count2);