JavaString.codePointAt()
メソッドcodePointAt()は、 int をパラメーターとして受け取り、指定されたインデックスのコードポイントを返します。 コードポイントは、文字がUnicode標準で指定されている10進値です。
利用可能な署名
public int codePointAt(int index)
例
@Test
public void whenCallCodePointAt_thenDecimalUnicodeReturned() {
assertEquals(97, "abcd".codePointAt(0));
}
スロー
- StringIndexOutOfBoundsException –存在しないインデックスがメソッドに渡された場合。
@Test(expected = StringIndexOutOfBoundsException.class)
public void whenPassNonExistingIndex_thenStringIndexOutOfBoundsExceptionThrown() {
int a = "abcd".codePointAt(4);
}