Full String Class Method is Java
Here is the List of Methods than can be applicable With String class . please Check Below Programme
===============================================================
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Com.interview;
import java.util.Locale;
/**
*
* @author anand
*/
public class StringFullMethod {
public static void main(String[] args) {
String s = "Anand";
System.out.println(s.charAt(1));
System.out.println(s.chars());
System.out.println(s.codePointAt(1));
System.out.println(s.codePointBefore(2));
System.out.println(s.codePointCount(1, 3));
System.out.println(s.codePoints());
System.out.println(s.compareTo("Antrish"));
System.out.println(s.compareToIgnoreCase("anand"));
System.out.println(s.concat(" Dwivedi"));
System.out.println(s.contains("An"));
System.out.println(s.contentEquals("Anand"));
System.out.println(s.contentEquals(new StringBuffer("Antrish")));
System.out.println(s.endsWith("d"));
System.out.println(s.equals(s));
System.out.println(s.getBytes().length);
System.out.println(s.getClass());
System.out.println(s.hashCode());
System.out.println(s.indexOf("A"));
System.out.println(s.indexOf(1));
System.out.println(s.indexOf("n", 2));
System.out.println(s.intern());
System.out.println(s.isEmpty());
System.out.println(s.lastIndexOf("a"));
System.out.println(s.lastIndexOf("n", 1));
System.out.println(s.length());
System.out.println(s.matches("Anand"));
System.out.println(s.offsetByCodePoints(1, 2));
System.out.println(s.replace("A", "a"));
System.out.println(s.replaceAll("Anand", "Antrish"));
System.out.println(s.replaceFirst("A", "n"));
System.out.println(s.split("").length);
System.out.println(s.toCharArray());
System.out.println(s.toLowerCase());
System.out.println(s.toLowerCase(Locale.GERMANY));
System.out.println(s.toString());
System.out.println(s.toUpperCase());
System.out.println(s.toUpperCase(Locale.FRENCH));
System.out.println(s.trim());
}
}
O/P
n
java.util.stream.IntPipeline$Head@b4c966a
110
110
2
java.util.stream.IntPipeline$Head@4e50df2e
-19
0
Anand Dwivedi
true
true
false
true
true
5
class java.lang.String
63402602
0
-1
3
Anand
false
2
1
5
true
3
anand
Antrish
nnand
5
Anand
anand
anand
Anand
ANAND
ANAND
Anand
BUILD SUCCESSFUL (total time: 0 seconds)
===============================================================
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package Com.interview;
import java.util.Locale;
/**
*
* @author anand
*/
public class StringFullMethod {
public static void main(String[] args) {
String s = "Anand";
System.out.println(s.charAt(1));
System.out.println(s.chars());
System.out.println(s.codePointAt(1));
System.out.println(s.codePointBefore(2));
System.out.println(s.codePointCount(1, 3));
System.out.println(s.codePoints());
System.out.println(s.compareTo("Antrish"));
System.out.println(s.compareToIgnoreCase("anand"));
System.out.println(s.concat(" Dwivedi"));
System.out.println(s.contains("An"));
System.out.println(s.contentEquals("Anand"));
System.out.println(s.contentEquals(new StringBuffer("Antrish")));
System.out.println(s.endsWith("d"));
System.out.println(s.equals(s));
System.out.println(s.getBytes().length);
System.out.println(s.getClass());
System.out.println(s.hashCode());
System.out.println(s.indexOf("A"));
System.out.println(s.indexOf(1));
System.out.println(s.indexOf("n", 2));
System.out.println(s.intern());
System.out.println(s.isEmpty());
System.out.println(s.lastIndexOf("a"));
System.out.println(s.lastIndexOf("n", 1));
System.out.println(s.length());
System.out.println(s.matches("Anand"));
System.out.println(s.offsetByCodePoints(1, 2));
System.out.println(s.replace("A", "a"));
System.out.println(s.replaceAll("Anand", "Antrish"));
System.out.println(s.replaceFirst("A", "n"));
System.out.println(s.split("").length);
System.out.println(s.toCharArray());
System.out.println(s.toLowerCase());
System.out.println(s.toLowerCase(Locale.GERMANY));
System.out.println(s.toString());
System.out.println(s.toUpperCase());
System.out.println(s.toUpperCase(Locale.FRENCH));
System.out.println(s.trim());
}
}
O/P
n
java.util.stream.IntPipeline$Head@b4c966a
110
110
2
java.util.stream.IntPipeline$Head@4e50df2e
-19
0
Anand Dwivedi
true
true
false
true
true
5
class java.lang.String
63402602
0
-1
3
Anand
false
2
1
5
true
3
anand
Antrish
nnand
5
Anand
anand
anand
Anand
ANAND
ANAND
Anand
BUILD SUCCESSFUL (total time: 0 seconds)
Comments
Post a Comment