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

热点内容
javavoid参数 浏览:829
如何让编程具有记忆功能 浏览:435
javamail发送带附件的邮件 浏览:173
微信分享文件到其他软件 浏览:682
微信对话文件夹在哪 浏览:287
qq头像欧美范街头男生 浏览:321
毛孔app 浏览:880
照片级渲染教程 浏览:304
目录中的文件夹有什么用 浏览:177
车载u盘文件扫描 浏览:410
稻壳文档怎样改文件名 浏览:620
cad怎么把文件存成模板 浏览:250
编程设计用什么笔记本流畅 浏览:584
电脑突然打开文件很慢 浏览:501
数据线一般是多少瓦的 浏览:314
javawebjsp简单项目实例 浏览:930
u盘lost文件夹删除不了 浏览:754
工具使用如何帮助提升工作效率 浏览:773
什么叫解压缩下载的文件 浏览:703
js监听浏览器窗口移动 浏览:225

友情链接