Click here to Skip to main content
15,887,683 members
Articles / Programming Languages / C#

Swap characters in a string

7 Nov 2011CPOL 1.7K   3
This is simpler and faster! Because it avoids creating a StringBuilder class, which is by far inefficient and slooow!string input = "AXBYCZ"; //Sample Stringchar[] chars = input.ToCharArray();Array.Reverse(chars);string output = new string(chars);}Cheers!
Only logged in members can view this content

Please go to the C# Table of Contents to view the list of available articles in this section.
Closed because the post is not clear, or is incomplete and has not been phrased in a way that allows it to be fully understood.. Reported by RaisKazi on Tuesday, November 8, 2011 12:48am