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