loop with letter char as the control variable

image_pdfimage_print
   
 
using System;
using System.Collections.Generic;
using System.Text;

class Program {
    static void Main(string[] args) {
        string greetingText = "www.kutayzorlu.com/java2s/com";

        for (int i = (int)'z'; i >= (int)'a'; i--) {
            char old1 = (char)i;
            char new1 = (char)(i + 1);
            greetingText = greetingText.Replace(old1, new1);
        }

        for (int i = (int)'Z'; i >= (int)'A'; i--) {
            char old1 = (char)i;
            char new1 = (char)(i + 1);
            greetingText = greetingText.Replace(old1, new1);
        }

        Console.WriteLine("Encoded:
" + greetingText);
    }
}