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 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