Tag Archives: Syntax

setLength(n)in JAVA – JAVA 10th Class notes – ICSE JAVA Notes

setLength(n)in JAVA – JAVA 10th Class notes – ICSE JAVA Notes setLength(n) : setLength(n) function allows you to set the length of a string buffer variable up to the specified range. If a string to be stored has more than the specified length then the characters exceeding the length are truncated, or otherwise stores NULL […]

delete(beg, end) in JAVA – JAVA 10th Class notes – ICSE JAVA Notes

delete(beg, end) in JAVA – JAVA 10th Class notes – ICSE JAVA Notes     delete(beg, end) : delete(beg, end) function is applied to delete the characters from one index to the other index in the given String.   Syntax : str1.delete(index1, index2);   Example : StringBuffer str = new StringBuffer(“COMMUTER”); str.delete(3,6);   Output : […]

setCharAt(index,c )in JAVA – JAVA 10th Class notes – ICSE JAVA Notes

setCharAt(index,c )in JAVA – JAVA 10th Class notes – ICSE JAVA Notes   setCharAt(index,c) : setCharAt(index,c) function can be applied to replace a character with the other character at the specified index.   Syntax : str1.setCharAt(index, character);   Example : StringBuffer str1 = new StringBuffer(“COMMUTER”); str1.insert(3, ‘P’);   Output : COMPUTER   /* Program to […]

insert(offset, x) in JAVA – JAVA 10th Class notes – ICSE JAVA Notes

insert(offset, x) in JAVA – JAVA 10th Class notes – ICSE JAVA Notes insert(offset, x) : insert(offset, x) function allows you to insert a String at the specified index into the another String. Syntax : str1.insert(index, str2); Example : StringBuffer str1 = new StringBuffer(“COMPUTER FUN”); StringBuffer str2 = new StringBuffer(“ IS”); str1.insert(8,str2);   Output : […]

append(x) in JAVA – JAVA 10th Class notes – ICSE JAVA Note

append(x) in JAVA – JAVA 10th Class notes – ICSE JAVA Notes append(x ) : append(x ) function lets you add String x at the end of the other String. Syntax : str1.append(str2); Example : StringBuffer str1 = new StringBuffer(“COMPUTER”); StringBuffer str2 = new StringBuffer(“ APPLICATION”); str1.append(str2);   Output : COMPUTER APPLICATION   /* Program […]

toString() JAVA – JAVA 10th Class notes – ICSE JAVA Notes

toString() JAVA – JAVA 10th Class notes – ICSE JAVA Notes toString( ) : toString( ) function converts the primitive data type to the String type. This conversion is important to apply the string functions on digits of the numbers.   Integer type to String type Conversion : Syntax : String res = Integer.toString(int);   […]

trim in JAVA – JAVA 10th Class notes – ICSE JAVA Notes

trim in JAVA – JAVA 10th Class notes – ICSE JAVA Notes trim( ) : trim( ) function is used to remove the blank spaces form either side of the string. The Blank spaces that are available in between the words, remain unchanged.   Syntax : String var= str.trim();   Example : String str= “  […]

substring(int beginindex, int endindex) in JAVA – JAVA 10th Class notes – ICSE JAVA Notes

substring(int beginindex, int endindex) in JAVA – JAVA 10th Class notes – ICSE JAVA Notes substring(int beginindex, int endindex) : substring(int beginindex, int endindex) function is used to extract a part of the string. This extracted part of the main string is known as the Substring. Syntax : String var=str.substring(index); Example : String str= “COMPUTER”; […]

replace( char oldch, char newch) in JAVA – JAVA 10th Class notes – ICSE JAVA Notes

replace( char oldch, char newch)  in JAVA – JAVA 10th Class notes – ICSE JAVA Notes   replace( char oldch, char newch) : replace( char oldch, char newch) function replaces all the occurrences of the specified old character with the new character within the given String.   Syntax : String res=str.replace (oldch, newch);   Example : […]

ToUpperCase in JAVA – JAVA 10th Class notes – ICSE JAVA Notes

ToUpperCase  in JAVA – JAVA 10th Class notes – ICSE JAVA Notes   toUpperCase( ) : toUpperCase( ) function will convert all the characters of the String to Upper Case. If any character is in Upper Case or it is a Special Character, then it will remain the same.   Syntax : String res = […]