开发者社区 问答 正文

如何用代码形式实现字符串的部分拆分处理?

已解决

如何用代码形式实现字符串的部分拆分处理?

展开
收起
起起又伏伏 2022-04-02 23:14:54 530 分享 版权
1 条回答
写回答
取消 提交回答
  • 推荐回答

    public class StringDemo

    public static void main(string args[]) {

    String str = "hello world hello mldn" ;

    String result [] =str.split("",2); //按照空格拆分

    for (int x=0;x<result.length;x++){

    System.out.println(result[x]);

    }

    }

    }

    2022-04-02 23:22:20
    赞同 展开评论
问答地址: