-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstringm.java
More file actions
28 lines (22 loc) · 908 Bytes
/
Copy pathstringm.java
File metadata and controls
28 lines (22 loc) · 908 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
26
27
28
public class stringm {
public static void main(String[] args) {
String name = "Shaluka";
int length = name.length();
char letter = name.charAt(0);
int index = name.indexOf("a");
int lastIndex = name.lastIndexOf("a");
name = name.toUpperCase();
System.out.println(name);
name = name.toLowerCase();
System.out.println(name);
System.out.println(index);
System.out.println(lastIndex);
System.out.println(length);
System.out.println(letter);
name = name.replace("s", "$");
System.out.println(name);
// name.isEmpty() -- check if name is empty
// name.contains(" ") -- chack if name contains spaces
// name.equals("Shaluka") -- check if 2 strings equal // name.equalsIgnoreCase("SHALUKA") to ignore upper case lower cases
}
}