首页 > 其他 > 详细

字符串拆分

时间:2018-07-09 18:59:53      阅读:218      评论:0      收藏:0      [点我收藏+]

示例1:

public String[] split(String regex)                           将字符串全部拆分

public String[] split(String regex,int limit)               将字符串全部拆分

 将字符串全部拆分处理

public class StringDemo {
    public static void main(String[] args) {
        String str = "hello world hello mldn";
        String result[] = str.split(" ");   //将字符串全部拆分,按照空格
        for(int x = 0;x < result.length;x ++){
            System.out.println(result[x]);
        }
    }
}

输出1:

hello
world
hello
mldn

 

字符串拆分

原文:https://www.cnblogs.com/yrxns/p/9284955.html

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