老千进来-->静夜思转移
JAVA脚本中有没有split这样的分割函数?就是"2007-03-28"这样的字符串,经过用"-"分割处理变成
2007,03,28组成的数组?
我知道VB里有,会用VB的,不会用JAVA的,印象中JAVA分割的还要带着分割符
----------------解决方案--------------------------------------------------------
此贴当锁或删。
----------------解决方案--------------------------------------------------------
----------------解决方案--------------------------------------------------------
笑什么?
----------------解决方案--------------------------------------------------------
-
[此贴子已经被作者于2007-3-27 13:57:19编辑过]
----------------解决方案--------------------------------------------------------
split
public String[] split(String regex)
- Splits this string around matches of the given regular expression.
This method works as if by invoking the two-argument
split
method with the given expression and a limit argument of zero. Trailing empty strings are therefore not included in the resulting array.The string "boo:and:foo", for example, yields the following results with these expressions:
Regex Result : { "boo", "and", "foo" } o { "b", "", ":and:f" } - Parameters:
regex
- the delimiting regular expression- Returns:
- the array of strings computed by splitting this string around matches of the given regular expression
- Throws:
PatternSyntaxException
- if the regular expression's syntax is invalid- Since:
- 1.4
- See Also:
Pattern
----------------解决方案--------------------------------------------------------
奇怪,我用的时候怎么不好用啊?我在看下啊
----------------解决方案--------------------------------------------------------
呵呵,是有的,是定义在String类里面的
如果要复杂点的,可以用java.util.regex包
----------------解决方案--------------------------------------------------------