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

熱點內容
智能控制webui界面程序 瀏覽:723
臨汾哪裡有學計算機編程 瀏覽:130
qq跳過申訴修改密碼 瀏覽:462
給文件夾加密win10 瀏覽:710
哪個app可以分辨航母 瀏覽:537
哪個app是英英詞典 瀏覽:23
javavoid參數 瀏覽:829
如何讓編程具有記憶功能 瀏覽:435
javamail發送帶附件的郵件 瀏覽:173
微信分享文件到其他軟體 瀏覽:682
微信對話文件夾在哪 瀏覽:287
qq頭像歐美范街頭男生 瀏覽:321
毛孔app 瀏覽:880
照片級渲染教程 瀏覽:304
目錄中的文件夾有什麼用 瀏覽:177
車載u盤文件掃描 瀏覽:410
稻殼文檔怎樣改文件名 瀏覽:620
cad怎麼把文件存成模板 瀏覽:250
編程設計用什麼筆記本流暢 瀏覽:584
電腦突然打開文件很慢 瀏覽:501

友情鏈接