Ad
Code
Diff
  • using System;
    
    public static class Kata
    {
        public static int SameCase(char a, char b)
        {
            var aZ = a <= 'Z';
            var bZ = b <= 'Z';
            var aIsLetter = a >= 'A' && a <= 'z' && (aZ || a >= 'a');
            if (aIsLetter != (b >= 'A' && b <= 'z' && (bZ || b >= 'a'))) return -1;
            return (!aIsLetter || aZ == bZ) ? 1 : 0;
        }
    }
    • using System;
    • public static class Kata
    • {
    • public static int SameCase(char a, char b)
    • {
    • if (!char.IsLetter(a) && !char.IsLetter(b))
    • return 1;
    • if (!char.IsLetter(a) || !char.IsLetter(b))
    • return -1;
    • return (char.IsUpper(a) == char.IsUpper(b)) ? 1 : 0;
    • var aZ = a <= 'Z';
    • var bZ = b <= 'Z';
    • var aIsLetter = a >= 'A' && a <= 'z' && (aZ || a >= 'a');
    • if (aIsLetter != (b >= 'A' && b <= 'z' && (bZ || b >= 'a'))) return -1;
    • return (!aIsLetter || aZ == bZ) ? 1 : 0;
    • }
    • }