String[] split(String regex)
Splits this string around matches of the given regular expression.
String[] split(String regex, int limit)
Splits this string around matches of the given regular expression.
Splits this string around matches of the given regular expression.
String[] split(String regex, int limit)
Splits this string around matches of the given regular expression.
解决方案 »
- SWING 很蛋疼... 球指教
- 求救啊
- double 数做乘法精度问题
- 一个关于JAVA对文件的输入输出问题,希望大侠们来给帮助~!!!!!!!!!!!!!!
- 一个礼拜都没解决的关于java.swing包下的JTree的第二级节点的问题!
- 请教,编写一个小程序
- 有人用java开发过Agent吗?
- JB做的APPLET打包后的JAR文件怎么放到网页中去呀?
- 为什么java rmi的helloworld程序不用生成stub也能运行
- Java 开发支持触摸程序
- 请问下面的java语段可行吗
- 请问各位,jdk1.3安装好以后该怎么用,还有就是,我如果用editplus该如何直接进行JAVA编译,谢谢
.........StringTokenizer stTemp = new StringTokenizer("this is a string"," ");//" "是空格
String[] b = new String[5];
int mIntCount = 0;
while(stTemp.hasMoreTokens())
{
try
{
b[mIntCount] = stTemp.nextToken();
System.out.println(b[mIntCount]);
mIntCount++;
}
catch(Exception e1)
{
}
}
.........StringTokenizer stTemp = new StringTokenizer("this is a string"," ");//" "是空格
Vector b = new Vector();while(stTemp.hasMoreTokens())
{
try
{
String temp = stTemp.nextToken();
System.out.println(temp);
b.addElement(temp);
}
catch(Exception e1)
{
}
}
{
String S1 = sourceString;
String S2 = spliter;
if(S1==null||S2==null||S1.equals("")||S2.equals(""))
{
return null;
}
else if(S1.length() <= S2.length())
{
if(S1.equals(S2))
{
return null;
}
else
{
String[] newArray = new String[1];
newArray[0] = S1;
return newArray;
}
}
else
{
String temp_String1 = "";
String temp_String2 = "";
//ArrayList array = new ArrayList();
Vector array = new Vector();
int length = S2.length();
int max = 0;
for(int i=0; i<S1.length(); i++)
{
max = (i + length >= S1.length()? S1.length():i + length);
temp_String1 = S1.substring(i, max);
if(temp_String1.equals(S2))
{
if(!temp_String2.equals(""))
{
// array.add(temp_String2);
array.addElement(temp_String2);
temp_String2 = "";
}
i += length - 1;
}
else
{
if(max!=S1.length())
{
temp_String2 += temp_String1.substring(0,1);
}
else
{
temp_String2 += temp_String1;
// array.add(temp_String2);
array.addElement(temp_String2);
i += length;
temp_String2="";
}
}
}
String[] returnArray = new String[array.size()];
/* for(int i=0; i<array.size(); i++)
{
returnArray[i] = (String)array.get(i);
}
*/
array.copyInto(returnArray);
return returnArray;
}
}