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

热点内容
怎样将镜像文件传到linux 浏览:542
从文件夹导入数据excel 浏览:238
日版苹果6s91解锁教程 浏览:177
新英朗储物盒内数据线怎么用 浏览:363
win10重装ssd分区 浏览:903
ug40升级补丁 浏览:338
3d建模文件转pdf 浏览:747
父母邦app订单如何退款 浏览:600
win10tftp服务器搭建 浏览:618
java调节系统音量 浏览:650
微信收藏容量在哪里看 浏览:600
g32螺纹编程p代表什么意思 浏览:132
qtwindows移植到linux 浏览:212
捷渡d600固件升级 浏览:577
word文档文件选项隐藏了 浏览:196
迪士尼官方app怎么改成中文版本 浏览:357
怎么读取苹果app文稿与数据 浏览:812
word如何打印出水印 浏览:177
初中生学学什么编程 浏览:903
保山相亲网站如何收费 浏览:898

友情链接