Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Dylan Bouchard   on Aug 20 In Java Category.

  
Question Answered By: Luz Hayes   on Aug 20

trim() function in String class is used to remove both leading and trailing
(white)spaces of a String.

for example:-

String str = " Hello World ");
System.out.println(str.trim());

will print only "Hello World" in ur console.
note: it will not remove blank spaces in-between the String

Share: 

 

This Question has 5 more answer(s). View Complete Question Thread

 
Didn't find what you were looking for? Find more on .trim Or get search suggestion and latest updates.


Tagged: