goback add

JAVA String.split方法

4554 点击·0 回帖
灯火互联
楼主
public String[] split(String regex)
根据给定的正则表达式的匹配来拆分此字符串。
该方法的作用就像是使用给定的表达式和限制参数 0 来调用两参数 split 方法。因此,结果数组中不包括结尾空字符串。
例如:
[java]
@Test  
    public void test() throws SQLException{  
        String testStr="A,B,C";  
        String [] results =  testStr.split(",");  
        for (String string : results) {  
            System.out.println(string);  
        }  
    }  
 
输出如下:
A
B
C

喜欢0 评分0