导航:首页 > 编程语言 > 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相关的资料

热点内容
录入数据库的图片如何更改 浏览:132
怎样获取邮箱帐号和密码 浏览:809
怎么通过js实现回到指定页面 浏览:140
如何用网络签字 浏览:552
三星电视拆机教程 浏览:19
创维怎么连接网络 浏览:868
2007版word绘图在哪里 浏览:311
可以拍车牌的app是什么 浏览:508
文件加个井字号什么意思 浏览:155
怎么删除多重网络 浏览:999
求生之路2局域网联机工具 浏览:827
说明文件结尾用什么词 浏览:578
发送的文件名变数字 浏览:778
档案数据库管理 浏览:992
微信acl是金融传销吗 浏览:620
企业如何通过进行网络营销 浏览:551
微信json转换错误 浏览:364
拉勾勾是什么网站 浏览:556
长沙哪个学校有大数据技术与应用 浏览:137
qq语音停止运行 浏览:312

友情链接