-
Notifications
You must be signed in to change notification settings - Fork 375
Expand file tree
/
Copy pathNewExercise.java
More file actions
67 lines (40 loc) · 1.34 KB
/
NewExercise.java
File metadata and controls
67 lines (40 loc) · 1.34 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
package com.serenitydojo;
import org.junit.Test;
public class NewExercise {
@Test
public void convertToLowerCase(){
//Converting to lower case
String bookTitle = "THE CAT IN THE HAT";
String lowerCaseTitle = bookTitle.toLowerCase();
System.out.println(lowerCaseTitle);
}
@Test
public void convertToUpperCase(){
//Converting to upper case
String bookTitle = "the cat in the hat";
String upperCaseTitle = bookTitle.toUpperCase();
System.out.println(upperCaseTitle);
}
@Test
public void trimExtraSpace(){
//Trim extra space
String bookTitle = " The Cat In The Hat ";
String str = " The Cat In The Hat ";
System.out.println(str);
System.out.println(str.trim());
}
@Test
public void findingTheLengthOfaString(){
// Finding The Length Of A String
String bookTitle = "The Cat In The Hat";
int stringSize= bookTitle.length();
System.out.println(bookTitle);
}
@Test
public void replacingTextInAstring() {
//Replacing text in a string
String bookTitle= "The Cat In The Hat";
String updatedTitle = bookTitle.replace("Hat", "Basket");
System.out.println(updatedTitle);
}
}