Simple way to Flip a string

I just thought sometimes simple extensions helps a lot. Like this Flip.

public static string Flip(this string target, bool trimEnds)
if (trimEnds) target= target.TrimIfNotNull();
var len = target.Length;
var newString = new string[len];

foreach (var c in target)
var temp = len;
newString[temp - 1] = c.ToString();

return string.Join(string.Empty, newString);

Call it this way

var returnString = mystring.Flip(true);

Leave a Reply

Your email address will not be published. Required fields are marked *

Notice: Undefined index: cookies in C:\hostingspaces\hoquecon\wordpress\wwwroot\wp-content\plugins\live-composer-page-builder\modules\tp-comments-form\module.php on line 1638