Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class NewClass1 {
- public static void main(String[] args){
- String country = "Bangladesh is a country";
- //Showing Character of Passing Index :
- char ch = country.charAt(0);
- System.out.println(ch);
- //Show ASCII Value of Passing Index :
- int value = country.codePointAt(0);
- System.out.println(value);
- //Show Position of Passing String:
- int pos = country.indexOf("is");
- System.out.println(pos);
- //Show Last Index of Passing Character:
- int position = country.lastIndexOf("n");
- System.out.println(position);
- //Removing First & Last Space of String:
- String s3 = country.trim();
- System.out.println(s3);
- String country = "Bangladesh is a country";
- //Replacing Character :
- String s2 = country.replace('i' , 'j');
- System.out.println(s2);
- //Splitting Where Passing String(space) :
- String[] s3 = country.split(" ");
- for(String x : s3){
- System.out.println(x);
- }
- //other(int,floatetc) to String :
- int i=100;
- String a = Integer.toString(i);
- System.out.println(a);
- //String to other :
- int j =Integer.parseInt(a);
- double d = Double.valueOf(a);
- System.out.println(j);
- System.out.println(d);
- }
- }
Add Comment
Please, Sign In to add comment