首页 > 其他 > 详细

用竖线分割的字符串的解析方式

时间:2015-02-02 15:25:21      阅读:581      评论:0      收藏:0      [点我收藏+]
public static void main( String[] args ) throws IOException
    {
        String str = "a|b";
        String[] strs = str.split("[|]");
        System.out.println(strs.length);
        if(strs.length>0){
            for(String s : strs){
                System.out.println("===:"+s);
            }
        }
        System.out.println(Arrays.asList(str.split("[|]")));
         
    }

结果:

2
===:a
===:b
[a, b]

用竖线分割的字符串的解析方式

原文:http://www.cnblogs.com/a198720/p/4267758.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!