Beispiel #1
0
        public static string Subsruct(string a, string b)
        {
            string res;

            if (HexInt.IsHex(a) && HexInt.IsHex(b))
            {
                int temp = int.Parse(a, NumberStyles.HexNumber) - int.Parse(b, NumberStyles.HexNumber);
                res = temp.ToString("X");
            }
            else
            {
                throw new Exception("Wrong Hex provided.");
            }
            return(res);
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            string a = HexInt.DecToHex(15);

            Console.WriteLine(a);
            string b = "D";

            if (HexInt.IsHex(b))
            {
                Console.WriteLine("That's great");
            }
            else
            {
                Console.WriteLine("That's awful");
            }

            string s = HexInt.And(a, b);

            s = HexInt.Or(a, b);
            Console.WriteLine($"{s}");
        }