-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_2b_7_mask_string.java
More file actions
64 lines (44 loc) · 1.48 KB
/
Copy path_2b_7_mask_string.java
File metadata and controls
64 lines (44 loc) · 1.48 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
import java.io.*;
import java.util.*;
class _2b_7_mask_string {
public static String removeChars(String string1, String string2) {
for (int index = 0; index < string2.length(); index++) {
char i = string2.charAt(index);
while (string1.contains(i + "")) {
int itr = string1.indexOf(i);
string1 = string1.replace((i + ""), "");
}
}
return string1;
}
public static void main(String[] args)
{
Scanner s = new Scanner(System.in);
System.out.println("\nEnter string: ");
String str = s.nextLine();
System.out.println("\nEnter mask string: ");
String mask = s.nextLine();
System.out.println(removeChars(str, mask));
}
}
//import java.util.*;
//import java.lang.String;
//class _2b_7_mask_string {
// public static void main(String[] args) {
// Scanner s = new Scanner(System.in);
// System.out.println("\nEnter string: ");
// String str = s.nextLine();
// char[] char_arr = str.toCharArray();
// System.out.println("\nEnter mask string: ");
// String mask = s.nextLine();
// char[] char_mask = str.toCharArray();
//
// for (int i=0; i<mask.length(); i++) {
// int index = str.indexOf(char_mask[i]);
// str=str.Remove(index,1);
//
// }
// int index = str.indexOf('R');
// str=str.Remove(index,1);
// }
//}