Tuesday, 27 August 2013

String function in JAVA

There are some important built in function of String variable


import java.util.*;

class Program
{
public static void main(String []args)
{
String value="YASIR SHABBIR";
String value1="Hello";
System.out.println(value.trim()); //Show String without whitespace
System.out.println(value..subString(2,4));  // Show the SubString the String value
System.out.println("Hello : "+value);  //   Concatenate the the String variable
System.out.println(value1+value); //   Concatenate the the String variable
System.out.println(value(charAt(2))); //Show the character at parameter position
if(value.equals("YASIR SHABBIR"))
System.out.println("Yes matach the result");


System.out.println(value.toUpperCase());  //Give the result in Upper Case
System.out.println(value.toLowerCase());  //Give the result in Lower case
System.out.println(value.length());  //Give the length of String


}
}

No comments:

Post a Comment