導航:首頁 > 編程語言 > 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相關的資料

熱點內容
c語言編程周長表示什麼 瀏覽:858
消防產品合格證如何在網路上查 瀏覽:467
電腦怎麼查看微信文件 瀏覽:225
iphone瀏覽器滾動 瀏覽:52
設置郵箱地址程序 瀏覽:690
pdf文件全部鏈接 瀏覽:456
秘密文件一般保存多少年 瀏覽:952
文件夾隱藏後怎麼恢復 瀏覽:251
文件恢復360 瀏覽:914
c打開文件夾選擇文件 瀏覽:430
工程變更文件需要多少份 瀏覽:227
風雲三國28文件修改器 瀏覽:461
哪個app有pets詞彙 瀏覽:926
蘋果6s看電影屏幕變暗 瀏覽:474
怎麼注冊文件 瀏覽:600
excel數字怎麼自動填入相同數據 瀏覽:652
上百萬條數據用什麼軟體處理 瀏覽:680
打開的程序不是全屏 瀏覽:837
不用u盤傳文件 瀏覽:673
什麼少兒編程課網課哪個好 瀏覽:98

友情鏈接