Topic: 请教怎样以多个字符作为间隔分割字符串 |
Print this page |
1.请教怎样以多个字符作为间隔分割字符串 | Copy to clipboard |
Posted by: mrs_cadbary Posted on: 2005-12-16 23:36 想用string的split方法分割字段,如果是以多个字符作为间隔呢,比如"..",我用了\\转义,但是程序运行时似乎把一个"."或者是"0."作为分隔符了,奇怪中 |
2.Re:请教怎样以多个字符作为间隔分割字符串 [Re: mrs_cadbary] | Copy to clipboard |
Posted by: tomkan Posted on: 2005-12-17 00:13 如".." 用成:"\.\."两个"\"才是 |
3.Re:请教怎样以多个字符作为间隔分割字符串 [Re: mrs_cadbary] | Copy to clipboard |
Posted by: why Posted on: 2005-12-17 02:09 http://java.sun.com/j2se/1.4.2/docs/api/java/lang/String.html#split(java.lang.String) public String[] split(String regex) Splits this string around matches of the given regular expression. String[] resultStrings = stringToSplit.split("\\.\\."); Show us your code and the result if you still couldn't get it done. |
Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1 客服电话 18559299278 客服信箱 714923@qq.com 客服QQ 714923 |