Skip to content

Commit 57f8f66

Browse files
committed
add RemoveAChar.java
1 parent a6a4308 commit 57f8f66

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

src/RemoveAChar.java

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
public class RemoveAChar {
2+
3+
public static void main(String[] args) {
4+
5+
String word = "GitHub";
6+
7+
System.out.print("word to be modified `");
8+
System.out.print(word);
9+
System.out.print("` ...");
10+
System.out.print(" script will remove ");
11+
12+
String charToBeRemoved = "H";
13+
String charToReplace = "-";
14+
15+
System.out.print(charToBeRemoved);
16+
System.out.print(", to be replaced by ");
17+
System.out.print(charToReplace);
18+
System.out.print(", result: `");
19+
20+
word = word.replace(charToBeRemoved, charToReplace);
21+
22+
System.out.print(word);
23+
System.out.println("`");
24+
25+
}
26+
27+
}

0 commit comments

Comments
 (0)