作用背景:一串字符串中的信息有些是有用的有些是多余的,我们需要把多余的信息去掉
例:"11,22,33,44,55"
这串字符串中我们要取出所有非","的内容
public class test { public static void main(String[] args) { String[] all = split_String("11,22,33,44,55", ","); for(int i=0;i 实现效果: 可以看到字符串中的","已经全部去除了split(String sp)方法返回的是一个字符串数组,方法中的参数是需要去除的内容 如果我们需要去除的内容不止",",我在去除掉","的同时也想去除掉数字1。这种多条件的情况只需要在条件间添加"|"就行了,如下: public class test { public static void main(String[] args) { String[] all = split_String("11,22,33,44,55", ",|1"); for(int i=0;i