-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstring.java
More file actions
49 lines (38 loc) · 1.1 KB
/
string.java
File metadata and controls
49 lines (38 loc) · 1.1 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import java.util.*;
public class string {
// String str = "hello";
//
public static void main(String[] args)
{
// char[] strChar = {'h', 'e', 'l', 'l', 'o'};
// String str = "hello";
// System.out.println(str.hashCode());
String s = "Hello World";
String s2 = s.toLowerCase();
String s3 = s.toUpperCase();
Integer s4 = s.length();
System.out.println(s2);
System.out.println(s3);
System.out.println(s4);
}
//Hello World
//lowercase it
//uppercase it
//reverse it
//find the length
//find the index of 'e'
//find the index of 'l'
//find substring from index 1 to 3
//replace 'l' with 'm'
//replace vs replaceAll
//split it by ' '
//trim it
//concat it with " world" (with method)
//contains
//equals
//equalsIgnoreCase
//compareTo
// == vs equals
//difference between isBlank and isEmpty
//starts with, ends with
}