Java String.codePointAt() Java Java String 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()… Continue Reading string-code-point-at

Java String.startsWith() Java Java String The method startsWith() is a convenience method that checks whether a String starts with another String. We can also pass the index of the first character to start checking from. Available Signatures public boolean startsWith(String prefix) public boolean startsWith(String prefix, int toffset) Example @Test public… Continue Reading string-starts-with

Java String.replaceAll() Java Java String The method replaceAll() replaces all occurrences of a String in another String. Available Signatures public String replaceAll(String regex, String replacement) Example @Test public void whenCallReplace_thenCorrect() { String s = “I learn Spanish”; assertEquals(“I learn French”, s.replaceAll(“Spanish”, “French”)); } Next » Java String.split() « Previous Java… Continue Reading string-replace-all

Java String.copyValueOf() Java Java String The method copyValueOf() converts a character array to a String with the same contents. This method is equivalent to valueOf(char[]). The offset represents the index of the first element to start copying from, and the count represents the number of elements to copy. Available Signatures… Continue Reading string-copy-value-of