可以,在java里用StringTokenizer
Example:
String[] result = "this is a test".split("\\s");
for (int x=0; x<result.length; x++)
System.out.println(result[x]);prints the following output:
this
is
a
test
Example:
String[] result = "this is a test".split("\\s");
for (int x=0; x<result.length; x++)
System.out.println(result[x]);prints the following output:
this
is
a
test
解决方案 »
- Hibernate的Criteria查询问题
- 这是什么回事??????????
- 关于action中的实例变量与静态变量
- 关于一个远程登陆下载的问题,web server的用户登陆到存放资源的server进行下载文件,并且不能让用户看出后者的ip,如何实现呀??请大虾
- struts2在模拟一个注册功能怎么最后显示不出,麻烦大哥哥 ,敲一下, 我才学这个有点不怎么懂,帮我一下
- 请大家帮个忙 去Http://www.numbertide.com(去了的,报个名,就接分)
- 使用ORACLE的JDBC驱动该怎么配置?
- 帮我看看代码 用于applet 与 servlet通讯的
- 谁有支持jdbc2.0的mysql的jdbc驱动!
- code检查工具 检查出的问题 线程共享
- 各位大虾请帮帮忙~,急!
- 通过输入的出生日期自动计算出年龄是“多少岁多少月”
while (st.hasMoreTokens()) {
System.out.println(st.nextToken());
}
prints the following output: this
is
a
test
直接用s.trim().split(" ");就可以
建议分割前先trim,防止字符串两边的空格导致分割错误~~~
String tmp=time.subString(0,10);
我用下面的代码它总是报如下的错误org.apache.jasper.JasperException: Unable to compile class for JSPAn error occurred at line: 20 in the jsp file: /jsp/time_split.jsp
Generated servlet error:
D:\Example\site\work\org\apache\jsp\jsp\time_005fsplit_jsp.java:82: cannot resolve symbol
symbol : method subString (int,int)
location: class java.lang.String
String tmp=time.subString(0,10);