代码: String str = "the music made it hard to concentrate"; String delims = "[ ]+"; String[] tokens = str.split(delims); 结果为: the, music, made, it, hard, to, concentrate 原因: String.split(String regex):参数是一个正则表达式 转自:http://pages.cs.wisc.e
Java split(".") 和 split("\\.") 问题描述 使用 . 分解 IP 的各个段,并打印,如:192.168.10.123,分解为 192 168 10 123 使用如下程序处理: /** * Created by Miracle Luna on 2019/11/10 */ public class SplitIP { public static void main(String[] args) { String ip = "192.