当前位置: 技术问答>java相关
请问一下 如何在STRING中定位一个小数点?
来源: 互联网 发布时间:2015-03-24
本文导语: 帮帮我吧.... | String.indexOf(".") | 用这个方法试试 public static String[] splitStringByFullstop(String source){ if(source==null||source.trim().equals("")) return null; StringTokenizer FullstopToker = ...
帮帮我吧....
|
String.indexOf(".")
|
用这个方法试试
public static String[] splitStringByFullstop(String source){
if(source==null||source.trim().equals(""))
return null;
StringTokenizer FullstopToker = new StringTokenizer(source,".");
String[] result = new String[FullstopToker.countTokens()];
int i=0;
while(FullstopToker.hasMoreTokens()){
result[i] = FullstopToker.nextToken();
i++;
}
return result;
}
public static String[] splitStringByFullstop(String source){
if(source==null||source.trim().equals(""))
return null;
StringTokenizer FullstopToker = new StringTokenizer(source,".");
String[] result = new String[FullstopToker.countTokens()];
int i=0;
while(FullstopToker.hasMoreTokens()){
result[i] = FullstopToker.nextToken();
i++;
}
return result;
}
|
String.indexOf(".")