Remove Extra Spaces Java

[Solved] Remove Extra Spaces Java | Perl - Code Explorer | yomemimo.com
Question : how to strip trailing spaces in java

Answered by : wideeyed-wallaby-5omocmhhefjz

String str = new String(" apples ");
str.trim(); // result is a nes string "apple"

Source : | Last Update : Mon, 03 Aug 20

Question : remove extra spaces java

Answered by : yuan-tao

String after = before.trim().replaceAll(" +", " ");

Source : https://stackoverflow.com/questions/2932392/java-how-to-replace-2-or-more-spaces-with-single-space-in-string-and-delete-lead | Last Update : Mon, 11 Apr 22

Question : remove spaces java

Answered by : drab-dingo-zi2ptjh6t533

public class StringSpaces { public static void main(String[] args) { String str = " Hello World	"; str = str.trim(); System.out.println("String- " + str); }
}

Source : https://knpcode.com/java/java-basics/remove-spaces-from-string-java-trim-strip/ | Last Update : Thu, 06 Jan 22

Answers related to remove extra spaces java

Code Explorer Popular Question For Perl