String Class:
String is a set of characters. String is a class available from
[Link] package. String class provides us a huge collection of
methods.
String name=”Eklavya”;
String name=new String(“Eklavya”);
String Methods:
Method Name Description
Str2=[Link] Converts the string to lowercase
Str2=[Link] Converts the string to uppercase
Str2=[Link](‘x’,’y’) Replace all occurrences of x with y
Str2=[Link]() Remaining spaces from the beginning
and from the end.
[Link](str2) Return true if str1 is equal to str2
[Link](str2) Return true if str1 is equal to str2
ignoring the case of the characters.
[Link]() Gives the length of str1
[Link](n)n-index Gives nth character of str1
[Link](str2) Return negative if str1<str2,positive if
str1>str2 and zero if str1 equal to str2.
[Link](str2) Concatenates(joining)str1 with str2
[Link](n) Gives substring from the nth character
[Link](n,m) Gives substring starting from nth
character upto mth(not including mth)
[Link]() Forces to convert the data to be string.
[Link](‘x’) Gives the first occurrences of ‘x’ in the
string str1
[Link](‘x’,n) Gives the position of ‘x’ that occurs
after nth position in the string str1.
Int x=90;
String z=[Link]()----“90”