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

熱點內容
css文件夾修改路徑 瀏覽:662
怎樣將鏡像文件傳到linux 瀏覽:542
從文件夾導入數據excel 瀏覽:238
日版蘋果6s91解鎖教程 瀏覽:177
新英朗儲物盒內數據線怎麼用 瀏覽:363
win10重裝ssd分區 瀏覽:903
ug40升級補丁 瀏覽:338
3d建模文件轉pdf 瀏覽:747
父母邦app訂單如何退款 瀏覽:600
win10tftp伺服器搭建 瀏覽:618
java調節系統音量 瀏覽:650
微信收藏容量在哪裡看 瀏覽:600
g32螺紋編程p代表什麼意思 瀏覽:132
qtwindows移植到linux 瀏覽:212
捷渡d600固件升級 瀏覽:577
word文檔文件選項隱藏了 瀏覽:196
迪士尼官方app怎麼改成中文版本 瀏覽:357
怎麼讀取蘋果app文稿與數據 瀏覽:812
word如何列印出水印 瀏覽:177
初中生學學什麼編程 瀏覽:903

友情鏈接