Java Program To Remove White Spaces In A String
=====================================================================
public class RemoveWhiteSpaces {
public static void main(String[] args) {
String str = "Java Programming Selenium Automation";
str = str.replaceAll("\\s", "");
// //s --> This represents the single whitespace character in a String.
System.out.println("After removing the whitespaces in a String:" + str);
}
}
output:
=======
After removing the whitespaces in a String:JavaProgrammingSeleniumAutomation
Comments
Post a Comment