CSharp examples for System:String Case
Swap Cases in a String
using System.Text.RegularExpressions; using System.Text; using System.Globalization; using System.Collections.Generic; using System;/*from w w w .ja v a 2 s . com*/ public class Main{ public static string SwapCases(string input) { string ret = ""; for (int i = 0; i < input.Length; i++) { if (String.CompareOrdinal(input.Substring(i, 1), input.Substring(i, 1).ToUpper()) == 0) ret += input.Substring(i, 1).ToLower(); else ret += input.Substring(i, 1).ToUpper(); } return ret; } }