Rotational Cipher

in #ita2 months ago

using System;

public static class RotationalCipher

{

public static string Rotate(string text, int shiftKey){

    string letterN = "";

    shiftKey %= 26;

    foreach(char i in text){

        if(char.IsUpper(i)){

               char res = (char) ('A' + (i - 'A' + shiftKey) % 26);

               letterN += res;

            }

        else if (Char.IsLower(i)){

               char res = (char) ('a' + (i - 'a' + shiftKey) % 26);

               letterN += res;

            }

        

        else {

            letterN += i;

        }

    }

    return letterN;

}

}

Sort:  

Hey @drago18121996, here is a little bit of BEER from @isnochys for you. Enjoy it!

Learn how to earn FREE BEER each day by staking your BEER.

Thank you for your witness vote!
Have a !BEER on me!
To Opt-Out of my witness beer program just comment STOP below


Hey @drago18121996, here is a little bit of BEER from @isnochys for you. Enjoy it!

Did you know that <a href='https://dcity.io/cityyou can use BEER at dCity game to buy cards to rule the world.

Thank you for your witness vote!
Have a !BEER on me!
To Opt-Out of my witness beer program just comment STOP below