Java String.endsWith()

The method endsWith() is a convenience method that checks if a String ends with another given String. If the argument is an empty String, then the method returns true.

Available Signatures

[source,java,gutter:,false]

public boolean endsWith(String suffix)

Example

[source,java,gutter:,true]

@Test
public void whenCallEndsWith_thenCorrect() {
    String s1 = "test";

    assertTrue(s1.endsWith("t"));
}