0% found this document useful (0 votes)
2 views1 page

String

The document provides an overview of the String class in Java, which is part of the java.lang package and offers a variety of methods for string manipulation. Key methods include converting case, replacing characters, trimming spaces, checking equality, and obtaining substrings. Additionally, it explains how to convert other data types to strings.

Uploaded by

awesomecuts555
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views1 page

String

The document provides an overview of the String class in Java, which is part of the java.lang package and offers a variety of methods for string manipulation. Key methods include converting case, replacing characters, trimming spaces, checking equality, and obtaining substrings. Additionally, it explains how to convert other data types to strings.

Uploaded by

awesomecuts555
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

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”

You might also like