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

熱點內容
打開壓縮文件一直轉圈 瀏覽:72
怎麼除去文件名的後綴 瀏覽:107
如何學習下位機編程 瀏覽:206
日本人如何修復網路 瀏覽:373
江蘇量淘數據怎麼樣 瀏覽:422
一組數據2的方差是多少 瀏覽:535
電腦設置刪除顯示找不到文件 瀏覽:454
中國證券app有哪些 瀏覽:890
天正施工圖教程 瀏覽:428
家庭網路有什麼 瀏覽:126
紅米升級系統找不到私密文件 瀏覽:557
360衛士文件功能描述 瀏覽:350
魅藍e2升級yunos 瀏覽:381
修改ipadID密碼 瀏覽:308
男生去哪裡學編程 瀏覽:772
膩子數據怎麼恢復 瀏覽:699
win10特殊配置文件登錄 瀏覽:55
可視電話電源網站封住了怎麼辦 瀏覽:811
如何列印word批註 瀏覽:152
qq在線表格換成word文件 瀏覽:138

友情鏈接