Convert characters of a string to opposite case | C # program to toggle all characters ; Function to toggle characters ; Driver code
using System ; class GFG { static char [ ] S = " GeKf @ rGeek $ " . ToCharArray ( ) ; static void toggleChars ( ) { for ( int i = 0 ; i < S . Length ; i ++ ) { if ( char . IsLetter ( S [ i ] ) ) { S [ i ] = ( char ) ( ( int ) ( S [ i ] ) ^ ( 1 << 5 ) ) ; } } } public static void Main ( String [ ] args ) { toggleChars ( ) ; Console . Write ( " String ▁ after ▁ toggle ▁ " + " STRNEWLINE " ) ; Console . Write ( String . Join ( " " , S ) ) ; } }