Using the method replace(CharSequence target, CharSequence replacement)
in String, how can I make the target case-insensitive?
For example, the way it works right now:
String target = "FooBar";
target.replace("Foo", "") // would return "Bar"
String target = "fooBar";
target.replace("Foo", "") // would return "fooBar"
How can I make it so replace (or if there is a more suitable method) is case-insensitive so that both examples return "Bar"?
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…