Click here to watch in Youtube :
https://www.youtube.com/watch?v=JljS0ZLBgZA&list=UUhwKlOVR041tngjerWxVccw
Click the below Image to Enlarge
Java Tutorial : Java String (trim method) |
/* * public String trim() * * Returns: * -------- * A string whose value is this string, with any * leading and trailing white space removed, or this * string if it has no leading or trailing white * space. */ public class TrimDemo { public static void main(String[] args) { String str = " Welcome "; System.out.println("str = " + str); System.out.println("str length = " + str.length()); String trimedValue = str.trim(); System.out.println("trimedValue = " + trimedValue); System.out.println("trimedValue length = " + trimedValue.length()); } }
str = Welcome str length = 15 trimedValue = Welcome trimedValue length = 7
https://sites.google.com/site/javaee4321/java/StringDemo_trim_App.zip?attredirects=0&d=1
Github Link:
https://github.com/ramram43210/Java/tree/master/BasicJava/StringDemo_trim_App
Bitbucket Link:
https://bitbucket.org/ramram43210/java/src/dd11550cc5ffaba129bb5f9efdfd0a5ae76620ca/BasicJava/StringDemo_trim_App/?at=master
See also:
No comments:
Post a Comment