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

热点内容
怎么看三国志13版本 浏览:85
找不到应用的文件 浏览:679
dnf台服地图代码大全 浏览:118
aix系统文件查找某个字符 浏览:624
编程猫id是什么 浏览:69
Linux下读取很大的文件 浏览:693
WiFi密码怎么分享 浏览:778
为某学校设计一个网络建设方案 浏览:76
如何把c程序编程软件 浏览:853
cudp文件传输 浏览:452
mac文件保存找不到桌面 浏览:614
数控编程软件使用最多是哪个 浏览:324
root版本 浏览:61
html表格颜色代码 浏览:805
java双目运算符 浏览:159
qq古代唯美女生头像 浏览:893
app数据库服务器配置 浏览:938
如何在电视上安装米家app 浏览:991
二手物品哪个网站好 浏览:943
jdk转换时找不到文件 浏览:345

友情链接