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.
精彩评论