Sunday, 19 July 2015

SOME IMPORTANT METHOD THAT CAN BE USED IN STRING PROGRAMMES.

programme:-some important method you can used in string

1) s2=s1.toUpperCase;  converts the string s1 to all uppercase.
2) s2=s1.toLowerCase;  converts the string s1 to all lowercase;
3) s2=s1.replace('x' , 'y');  Replace all appearances of x with y
4) s1.equals(s2)   Returns 'true' if s1 is equal to s2
5) s1.length()   Gives the length of s1
6) s1.compareTo(s2)  Returns negative if s1<s2, positive if s1>s2, and zero if s1 is equal s2

No comments:

Post a Comment