JAVA split("|") 简单的问题~String str = "现金|50";String ss[] = str.split("|");应该是ss[0] = "现金";应该是ss[1] = "50";ss长度共2为什么我截取出来是ss长度是6个长度ss[0] = "";ss[1] = "现";ss[2] = "金";ss[3] = "|";ss[4]
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/16 02:43:24
JAVA split("|") 简单的问题~String str = "现金|50";String ss[] = str.split("|");应该是ss[0] = "现金";应该是ss[1] = "50";ss长度共2为什么我截取出来是ss长度是6个长度ss[0] = "";ss[1] = "现";ss[2] = "金";ss[3] = "|";ss[4]
JAVA split("|") 简单的问题~
String str = "现金|50";
String ss[] = str.split("|");
应该是ss[0] = "现金";
应该是ss[1] = "50";
ss长度共2
为什么我截取出来是ss长度是6个长度
ss[0] = "";
ss[1] = "现";
ss[2] = "金";
ss[3] = "|";
ss[4] = "5";
ss[5] = "0";
?
高手帮忙解释一下?
JAVA split("|") 简单的问题~String str = "现金|50";String ss[] = str.split("|");应该是ss[0] = "现金";应该是ss[1] = "50";ss长度共2为什么我截取出来是ss长度是6个长度ss[0] = "";ss[1] = "现";ss[2] = "金";ss[3] = "|";ss[4]
|
在正则里是个特殊字符,有意义所在的,或的意思
比如
",|;"按,或;来分隔
"|"等同于"",空或空的意思
正确的写法是
"\\|"或者"[|]"