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
Post a Comment