Stripping in Java using Strip()

Hirosh Tharaka
Nov 16, 2023

--

To remove the spaces/whitespaces in JAVA, the strip method was introduced. Below are the 3 methods and their use-cases for your reference;

strip() — Removes the leading and trailing spaces from the string.

stripLeading() — Removes the spaces from the beginning of the string.

stripTrailing() — Removes the spaces present from the end of the string.

--

--

Hirosh Tharaka
Hirosh Tharaka

Written by Hirosh Tharaka

BSc(Hons), CSM®, ISTQB® (CTFL, CTAL-TTA, CTAL-TM) | Technical Writer | Technical Tester (QA Lead)

No responses yet