-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStringBufferLib.java
More file actions
88 lines (53 loc) · 1.6 KB
/
StringBufferLib.java
File metadata and controls
88 lines (53 loc) · 1.6 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
82
83
84
85
86
87
88
package com.testing250.JavaDay2;
import java.util.Scanner;
public class StringBufferLib {
String v1="test data";
StringBuffer sb=new StringBuffer(v1);
Scanner c = new Scanner(System.in);
// create a stringbuffer and store the data , display the data
public void sb1() {
//String v1="test data";
System.out.println(sb);
}
// Taking input
public void sb2() {
String s1 = c.nextLine();
StringBuffer sb1 = new StringBuffer(s1);
System.out.println(sb1);
}
// Append
public void TestAppend() {
String data = "1234";
StringBuffer sb3 = new StringBuffer(data);
System.out.println(sb3.append("56464"));
System.out.println(sb3);
}
public String PerformReverse(String Str) {
StringBuffer sb3 = new StringBuffer(Str);
System.out.println(sb3);
StringBuffer sb4 = sb3.reverse();
String val4 = sb4.toString();
return val4;
}
public void Delete_from_buffer() {
StringBuffer sb5 = new StringBuffer("Test automation framework");
sb5.delete(5, 14);
System.out.println(sb5);
}
public void Insert_Into_Buffer() {
String v6 = "test data";
StringBuffer p = new StringBuffer(v6);
p.insert(5, "55992896 ");
System.out.println(p);
}
public static void main(String[] args) {
StringBufferLib o1= new StringBufferLib();
o1.sb1();
o1.sb2();
o1.TestAppend();
String result = o1.PerformReverse("hello123test");
System.out.println(result + "reversed data");
o1.Delete_from_buffer();
o1.Insert_Into_Buffer();
}
}