fork(10) download
  1. import java.util.*;
  2. import java.util.regex.*;
  3.  
  4. class Demo {
  5. static public void main(String[] args) {
  6. String lock = "O_2_^-^";
  7. String str = " O_2_^-^ ";
  8.  
  9. System.out.println(str);
  10. System.out.println(lock);
  11. System.out.println(str.contains(lock));
  12. str = str.replaceFirst(Pattern.quote(lock), "");
  13. System.out.println("|" + str + "|");
  14. }
  15. }
  16.  
Success #stdin #stdout 0.07s 380224KB
stdin
Standard input is empty
stdout
 O_2_^-^ 
O_2_^-^
true
|  |