对于
s1
They arestudents. 和s2
aeiou
;去掉s1中包含的s2中的字符,输出Thy r stdnts.
public
class
subString{
public
static
void
main(String[]
args
){
String
s1
=
“They are students.”
;
String
s2
=
“aeiou”
;
boolean
[]
array
=
new
boolean
[128];
//
标准
ASCII
码有
128
个,包括空格
for
(
int
i
=0;
i
<
s2
.length();++
i
){
array
[
s2
.charAt(
i
)]=
true
;
}
for
(
int
i
=0;
i
<
s1
.length();++
i
){
if
(
array
[
s1
.charAt(
i
)]==
false
)
System.
out
.print(
s1
.charAt(
i
));
}
}
}