Reputation: 3324
I was wondering how I can rearrange the contents within a string. For example,
if it was String s = "Stack,over,flow";
How can I change the position of flow with stack or stack with over?
Upvotes: 2
Views: 1413
Reputation: 8295
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.
Upvotes: 2