开发者

How can i rearrange the contents within a string? Java

开发者 https://www.devze.com 2023-02-21 10:42 出处:网络
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 o

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

精彩评论

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