Java 相當於 Explode 和 Implode(PHP) [關閉] - Java equivalent to Explode and Implode(PHP) [closed]

問題:

Closed. 關閉。 This question does not meet Stack Overflow guidelines . 此問題不符合Stack Overflow 準則 It is not currently accepting answers. 它目前不接受答案。

Want to improve this question?想改善這個問題嗎? Update the question so it's on-topic for Stack Overflow.更新問題,使其成爲 Stack Overflow的主題

Closed 8 years ago . 8 年前關閉。

I am new in Java although had a good experience in PHP, and looking for perfect replacement for explode and implode (available in PHP) functions in Java.我是 Java 新手,儘管在 PHP 方面有很好的經驗,並且正在尋找 Java 中爆炸和內爆(在 PHP 中可用)函數的完美替代品。

I have Googled for the same but not satisfied with the results.我用谷歌搜索了相同的但對結果不滿意。 Anyone has the good solution for my problem will be appreciated.任何人對我的問題有好的解決方案將不勝感激。

For example:例如:

String s = "x,y,z";
//Here I need a function to divide the string into an array based on a character.
array a = javaExplode(',', s);  //What is javaExplode?
System.out.println(Arrays.toString(a));

Desired output:期望的輸出:

[x, y, z]

解決方案:

參考: https://stackoom.com/en/question/18NZv
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章