I just announced the new Spring 5 modules in REST With Spring:

>> CHECK OUT THE COURSE

This article is part of a series:
• Java String.String()
• Java String.codePointAt()
• Java String.codePointCount()
• Java String.codePointAt()
• Java String.concat()
• Java String.contains()
• Java String.copyValueOf()
• Java String.endsWith()
• Java String.format()
• Java String.getBytes()
• Java String.indexOf()
• Java String.intern()
• Java String.isEmpty()
• Java String.lastIndexOf()
• Java String.regionMatches()
• Java String.replace()
• Java String.replaceAll()
• Java String.split()
• Java String.startsWith()
• Java String.subSequence()
• Java String.substring()
• Java String.toLowerCase()
• Java String.toUpperCase()
• Java String.trim()
• Java String.valueOf()

The method codePointAt() takes an int as a parameter and returns the code point at the specified index. A code point is a decimal value that the character is given in the Unicode standard.

Available Signatures

public int codePointAt(int index)

Example

@Test
public void whenCallCodePointAt_thenDecimalUnicodeReturned() {
    assertEquals(97, "abcd".codePointAt(0));
}

Throws

  • StringIndexOutOfBoundsException – if a non-existent index is passed to the method.
@Test(expected = StringIndexOutOfBoundsException.class)
public void whenPassNonExistingIndex_thenStringIndexOutOfBoundsExceptionThrown() {
    int a = "abcd".codePointAt(4);
}

I just announced the new Spring 5 modules in REST With Spring:

>> CHECK OUT THE LESSONS