0% found this document useful (0 votes)
4 views2 pages

Java String Methods Explained

Uploaded by

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

Java String Methods Explained

Uploaded by

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

package String.

Basic;

public class StringAllmethod {


public static void main(String[] args) {
// its normal a string
String a = "Ram Ji ke Jay";

// this method convert all character to upper character


[Link]([Link]());

// this method convert all character to lower character of given string


[Link]([Link]());

//this method trim means removing unwanted spaces in a string


String s = " Ritik Bhai ";
[Link]("without trim method "+s);
[Link]("with trim method : - "+[Link]());

// this method see the string is starting with given word or not?
[Link]("start with method : - "+[Link]("Ram"));

// this method see the string is ending with given word or not
[Link]("end with method : - "+[Link]("Jay"));

//this method see in the position which character present


[Link]("konsa character hai ush position pe : -
"+[Link](2));

//converting any datatype to a string


int b =456;
[Link]("Converting any data type to string
"+[Link](b));

// replacing the character of string


[Link]("first old character which we want to replace then
second character"+[Link]("e","i"));

// checking string containing the character or not


[Link](" Contains method "+[Link]("Jay"));

//substring bana de ga
[Link]("Substring wala chije : - "+[Link](2,5));
[Link]("ish me 2 index inclusive hai and 5 exclusive");

// split the string with the specific things


[Link]("jaha jaha pe 'a' hai waha se tut ja");
String wor [] =[Link]("a");
for(String word :wor){
[Link](word);
}

[Link]();
//this method help to converting the string to character array
char [] ch =[Link]();
[Link]("converting to charcter array : - ");

for(char ca :ch){
[Link](ca);
}

[Link]();
// checking the string is empty or not

[Link]("kya ye string empty hai : -"+ [Link]());


}
}

You might also like