Click here to Skip to main content
15,867,453 members
Articles / Programming Languages / C#

How to Toggle String Case in .Net

Rate me:
Please Sign up or sign in to vote.
5.00/5 (14 votes)
9 Feb 2011CPOL 16.9K   9  
This one should outperform both the other methods for longer strings because of the StringBuilder.string s = "AbCdEfGhI§$%&/()1234567890";var sb = new StringBuilder(s.Length);foreach (char c in s) sb.Append(char.IsUpper(c) ? char.ToLower(c) : char.ToUpper(c));s =...
No downloads associated with this content

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
Germany Germany
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions