c# - Need help with string manipulation please -


if string has values :-

mystring = "good morning,good night"; 

and want reverse values in follows:-

i want final values in mystring as:-

mystring = "good night,good morning"; 

how achieve this? appreaciated. thanks. :)

how about:

string mystring = "good morning,good night"; string[] substrings = mystring.split(','); mystring = string.join(",", substrings.reverse()); 

or if write these 1 liners:

mystring = string.join(",", mystring.split(',').reverse()); 

Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -