Ad
Code
Diff
  • public class Kata
    {
        public static int SameCase(char a, char b)
        {
    
            bool isUpperA;
            bool isUpperB;
    
            if (a >= 97 && a <= 122)
            {
                isUpperA = false;
            }
            else if (a >= 65 && a <= 90)
            {
                isUpperA = true;
            }
            else
            {
                return -1;
            }
    
            if (b >= 97 && b <= 122)
            {
                isUpperB = false;
            }
            else if (b >= 65 && b <= 90)
            {
                isUpperB = true;
            }
            else
            {
                return -1;
            }
    
            if ( isUpperA == isUpperB )
            {
                return 1;
            }
            else
            {
                return 0;
            }
        }
    }
    • public class Kata {
    • public static int SameCase(char a, char b) {
    • string letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    • char tempA = a;
    • char tempB = b;
    • if((!letters.Contains(tempA = char.ToUpper(tempA)) && letters.Contains(tempB = char.ToUpper(tempB))) ||
    • (!letters.Contains(tempB = char.ToUpper(tempB)) && letters.Contains(tempA = char.ToUpper(tempA))) ||
    • (!letters.Contains(tempA = char.ToUpper(tempA)) && !letters.Contains(tempB = char.ToUpper(tempB)))) return -1;
    • if(char.IsUpper(a) && char.IsUpper(b)){
    • return 1;
    • } else if (char.IsLower(a) && char.IsLower(b)){
    • return 1;
    • } else {
    • return 0;
    • public class Kata
    • {
    • public static int SameCase(char a, char b)
    • {
    • bool isUpperA;
    • bool isUpperB;
    • if (a >= 97 && a <= 122)
    • {
    • isUpperA = false;
    • }
    • else if (a >= 65 && a <= 90)
    • {
    • isUpperA = true;
    • }
    • else
    • {
    • return -1;
    • }
    • if (b >= 97 && b <= 122)
    • {
    • isUpperB = false;
    • }
    • else if (b >= 65 && b <= 90)
    • {
    • isUpperB = true;
    • }
    • else
    • {
    • return -1;
    • }
    • if ( isUpperA == isUpperB )
    • {
    • return 1;
    • }
    • else
    • {
    • return 0;
    • }
    • }
    • }
    • }