-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.java
More file actions
81 lines (60 loc) · 2.1 KB
/
main.java
File metadata and controls
81 lines (60 loc) · 2.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
package com.asrez;
import com.asrez.utils.MyString;
public class main {
public static void main(String[] args) {
System.out.println("Stage1"); //////////////////////////
MyString input1 = new MyString('T');
input1.setAt(1, 'E');
input1.setAt(2, '!');
input1.setAt(3, 'S');
input1.setAt(4, 'T');
input1.display();
System.out.println("Stage2"); //////////////////////////
MyString input2 = new MyString(input1);
System.out.println(input2.charAt(0));
input2.display();
System.out.println(input2.length());
System.out.println("Stage3"); //////////////////////////
char[] array = input2.toCharArray();
System.out.println(array);
System.out.println("Stage4"); //////////////////////////
input2 = input2.concat(input1);
input2.display();
System.out.println(input2.length());
System.out.println("Stage5"); //////////////////////////
MyString input3 = input2.subString(0, 3);
input3.display();
System.out.println("Stage6"); //////////////////////////
input3 = input2.subString(3);
input3.display();
System.out.println("Stage7"); //////////////////////////
input3 = input2.subString(-3);
input3.display();
System.out.println("Stage8"); //////////////////////////
input3 = input2.subString(-5, 2);
input3.display();
System.out.println("Stage9"); //////////////////////////
input3 = input2.subString(-5, 90);
input3.display();
System.out.println("Stage10"); //////////////////////////
input1.toLowerCase().display();
input1.toUpperCase().display();
MyString.printf("Hello %% '%d' %% %s with %f value%c\n", 110, "Hello", 3.14, '!');
// System.out.println("Hello!");
// MyString s=new MyString("hello");
MyString s=new MyString("hello how are youllol? are you llolo?");
System.out.println(s.count("l"));
// s.replaceAndUpdate('l', '*');
// s.display();
// s.replaceAndUpdate("l", "*");
// s.display();
s=s.replace("l", "*", 1);
s.display();
// if(s.startsWith("hel")) {
// System.out.println("yes");
// }
// else {
// System.out.println("no");
// }
}
}