java 分割字符串
碰到一个字符串 “A|B” 需要通过'|'来分割这个字符串 调用“A|B”.split("|"); 却不能分割成功。
原来"|"是正则表达式中特殊字符,不能直接这么使用,如果想实现分割功能需要
String test = "A|B";
String[] arrDescs = test.split("\\|");
碰到一个字符串 “A|B” 需要通过'|'来分割这个字符串 调用“A|B”.split("|"); 却不能分割成功。
原来"|"是正则表达式中特殊字符,不能直接这么使用,如果想实现分割功能需要
String test = "A|B";
String[] arrDescs = test.split("\\|");
暂无评论。
评论功能维护中,当前仅展示历史评论。