ran*_*ech 7 java string sorted character alphabetical
如何创建一个字符串,其字母顺序字母取自另一个字符串?
假设我有类似的东西
String theWord = "Hello World";
Run Code Online (Sandbox Code Playgroud)
如何计算新String以使其看起来像"
dehllloorw
这是theWord但按字母顺序按字符排序.
提前致谢
Sea*_*oyd 28
char[] chars = theWord.toCharArray();
Arrays.sort(chars);
String newWord = new String(chars);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
31244 次 |
| 最近记录: |