-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstringoperation.java
More file actions
25 lines (21 loc) · 836 Bytes
/
Copy pathstringoperation.java
File metadata and controls
25 lines (21 loc) · 836 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package Assignment1;
import java.util.Scanner;
public class stringoperation {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc = new Scanner(System.in);
String s= sc.nextLine();
System.out.println( "length of the String : " + s.length());
System.out.println("character at specific index : " + s.charAt(2));
System.out.println("String is empty or not" + s.isEmpty());
System.out.println("index of particular character " + s.indexOf('e'));
System.out.println("s.lastIndexof('e')");
System.out.println(s.startsWith("app"));
System.out.println(s.contains("ple"));
System.out.println(s.toLowerCase());
System.out.println(s.replace('p', 'm'));
System.out.println(s.trim());
System.out.println(s.substring(2 , 4));
System.out.println(s.endsWith("le"));
}
}