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

>> CHECK OUT THE COURSE

The method trim() removes any whitespace at the beginning and at the end of a String. If the String contains only spaces, then the method returns an empty String.

Available Signatures

public String trim()

Example

@Test
public void whenTrim_thenCorrect() {
    assertEquals("foo", " foo  ".trim());
}
Next »
Java String.valueOf()
« Previous
Java String.toUpperCase()

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

>> CHECK OUT THE LESSONS