導航:首頁 > 編程語言 > 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
word壓縮文件如何解壓 瀏覽:592
蘋果5S桌面軟體刪除不了一 瀏覽:62
蘋果4怎麼弄圖案密碼鎖 瀏覽:131
蘋果4s換外屏操作流程 瀏覽:33
用app畫畫眼珠怎麼改 瀏覽:295
qq好友突然上線過一會又下線了 瀏覽:947
網路文件系統是freebs 瀏覽:188
程序員ppt 瀏覽:835
pM編程哪個版本主流 瀏覽:764
編程屬於什麼大學 瀏覽:987
如何給郵箱發文件 瀏覽:365
電腦硬體好壞檢測工具 瀏覽:500
北京做網站推廣工資多少 瀏覽:761
什麼不允許出現在長文件名中 瀏覽:924
zdid1是什麼手機文件 瀏覽:24
買公路車去什麼app 瀏覽:907
vb仿qq列表 瀏覽:97
微信小程序論壇項目 瀏覽:631
jsf是什麼的後綴 瀏覽:195

友情鏈接