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

熱點內容
怎麼添加描述文件 瀏覽:890
路由固件開發工具 瀏覽:819
flash代碼checkbox顯示文字 瀏覽:226
java定義矩陣 瀏覽:609
如何創建word文檔 瀏覽:708
ug80模具設計全套教程 瀏覽:730
蘋果手機6p自帶壁紙 瀏覽:535
applestore評論不了 瀏覽:223
單韻母app哪個好 瀏覽:213
jstl和el習題 瀏覽:371
素描教學的網站有哪些 瀏覽:335
內存文件是干什麼的 瀏覽:725
win7共享登陸不用密碼怎麼設置 瀏覽:12
電腦分盤怎麼分app 瀏覽:476
手機安裝沒有應用程序怎麼辦 瀏覽:932
jsp按鈕關閉 瀏覽:63
資料庫的組織模型 瀏覽:852
怎麼用vi清空文件內容 瀏覽:953
為什麼我把文件重命名改了 瀏覽:52
菜單進行文件夾移動需要經過 瀏覽:72

友情鏈接