导航:首页 > 编程语言 > stringtokenizerjava

stringtokenizerjava

发布时间:2025-03-04 22:25:06

① 在java中什么意思public class stringtokenizer implements enumeration

定义一个叫stringtokenizer的类,并使它实现enumeration接口。

② java中的StringTokenizer怎么用

API文档中,就有例子

A token is returned by taking a substring of the string that was used to create the StringTokenizer object.

The following is one example of the use of the tokenizer. The code:

StringTokenizer st = new StringTokenizer("this is a test");
while (st.hasMoreTokens()) {
System.out.println(st.nextToken());
}

prints the following output:

this
is
a
test

StringTokenizer is a legacy class that is retained for compatibility reasons although its use is discouraged in new code. It is recommended that anyone seeking this functionality use the split method of String or the java.util.regex package instead.

The following example illustrates how the String.split method can be used to break up a string into its basic tokens:

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

Since:
JDK1.0
See Also:
StreamTokenizer

阅读全文

与stringtokenizerjava相关的资料

热点内容
怎么添加描述文件 浏览:890
路由固件开发工具 浏览:819
flash代码checkbox显示文字 浏览:226
java定义矩阵 浏览:609
如何创建word文档 浏览:708
ug80模具设计全套教程 浏览:730
苹果手机6p自带壁纸 浏览:535
applestore评论不了 浏览:223
单韵母app哪个好 浏览:213
jstl和el习题 浏览:371
素描教学的网站有哪些 浏览:335
内存文件是干什么的 浏览:725
win7共享登陆不用密码怎么设置 浏览:12
电脑分盘怎么分app 浏览:476
手机安装没有应用程序怎么办 浏览:932
jsp按钮关闭 浏览:63
数据库的组织模型 浏览:852
怎么用vi清空文件内容 浏览:953
为什么我把文件重命名改了 浏览:52
菜单进行文件夹移动需要经过 浏览:72

友情链接