开发者

How can i rearrange the contents within a string? Java

I was wondering how I can rearrange the contents within a strin开发者_运维百科g. For example, if it was String s = "Stack,over,flow"; How can I change the position of flow with stack or stack with over?


there is not built-in support, the most obvious solution i think is:

String s = "Stack,over,flow";
String[] arr = s.split(",");
// now you have all the parts in arr, you can reconstrut your new string here.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜