Ad
Code
Diff
  • public class Kata {
      public static int SameCase(char a, char b) => (char.IsLower(a)&&char.IsLower(b)||char.IsUpper(a)&&char.IsUpper(b))? 1 : (char.IsLetter(a)&&char.IsLetter(b))? 0 : -1;
    }
    • 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 static int SameCase(char a, char b) => (char.IsLower(a)&&char.IsLower(b)||char.IsUpper(a)&&char.IsUpper(b))? 1 : (char.IsLetter(a)&&char.IsLetter(b))? 0 : -1;
    • }