public class replaceBracket {
public static void main(String[] args){
String Node = "万达购物中心(室内)";
String newNode = "";
if(Node.contains("(") && Node.contains(")")){
newNode = Node.replace("(", "(");
System.out.println(newNode);
}
}
}
这个方法只能替换为:万达购物中心(室内),替换了左边的中文括号但却没有替换右边的中文括号。
public static void main(String[] args){
String Node = "万达购物中心(室内)";
String newNode = "";
if(Node.contains("(") && Node.contains(")")){
newNode = Node.replace("(", "(");
System.out.println(newNode);
}
}
}
这个方法只能替换为:万达购物中心(室内),替换了左边的中文括号但却没有替换右边的中文括号。
newNode = Node.replace("(", "(");
newNode = newNode.replace(")", ")");System.out.println(newNode);
String Node = "万达购物中心(室内)";
String s = null;
System.out.println(s = Node.replaceAll("(", "("));
System.out.println(s = s.replaceAll(")", ")"));
}