Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
嗨,我有一个关于 java split 的问题
ItemName,Item,,(width,length,height),12
我想要 String[] 等于这个”
String[] result ={"ItemName","Item","","(width,length,height)","12"};
谁能帮助我使用拆分函数或其他正则表达式?
如果您的输入字符串名为istr,则
String[] result = istr.split(",");
应该管用。
尝试这个
String data="ItemName,Item,,(width,length,height),12"; String[] result=data.split("//,"); for(String string : result) { System.out.println(string); }