Tips for heathy life

Tips for heathy life

Kamis, 30 Oktober 2008

Comparing the beginning and end of a string in J2SE



I want to share how to Comparing the beginning and end of a string. You can use this code but if you copy this code and paste in your blog/website, please insert this link of article.

String str1="Hello Java";

System.out.println(str1.startsWith("Hello")); //true
System.out.println(str1.startsWith("Ello",1)); //false
System.out.println(str1.endsWith("Java")); //true

0 komentar:

Posting Komentar