62,614
社区成员
发帖
与我相关
我的任务
分享
public class Test {
public static void main(String[] args) {
String str = "我你我你我我我我们你们们你你我我我们你你你你们我";
System.out.println(str.replaceAll("我们|你们", ""));
}
}
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author y
*/
public class Main {
public static void main(String[] argc){
String str="我你我你我我我我们你们们你你我我我们你你你你们我";
Pattern p = Pattern.compile("[^我们]+");
String[] t = p.split(str);
for(int i=0;i<t.length;i++)
{
System.out.println(t[i]);
}
}
}