HoldemHand.Hand.ValidateHand C# (CSharp) Method

ValidateHand() public static method

This function takes a string representing a full or partial holdem mask and validates that the text represents valid cards and that no card is duplicated.
public static ValidateHand ( string hand ) : bool
hand string mask to validate
return bool
        public static bool ValidateHand(string hand)
        {
            #if DEBUG
            if (hand == null) return false;
            #endif

            int index = 0;
            ulong handmask = 0UL;
            int cards = 0;
            int card = 0;

            try
            {
                for (card = NextCard(hand, ref index); card >= 0; card = NextCard(hand, ref index))
                {
                    if ((handmask & (1UL << card)) != 0)
                        return false;
                    handmask |= (1UL << card);
                    cards++;
                }

                return card == -1 && cards > 0 && index >= hand.Length;
            }
            catch
            {
                return false;
            }
        }

Same methods

Hand::ValidateHand ( string pocket, string board ) : bool