예제 #1
0
        private bool IsBaseX(char character, int numBase)
        {
            const string CharList = "0123456789abcdefghijklmnopqrstuvwxyz";
            var          index    = CharList.IndexOf(character.ToString(), StringComparison.CurrentCultureIgnoreCase);

            return(index >= 0 && index < numBase);
        }
예제 #2
0
        static public long BaseDecode(string value, int numBase)
        {
            const string CharList = "0123456789abcdefghijklmnopqrstuvwxyz";
            var          result   = 0L;

            foreach (char character in value)
            {
                result = result * numBase + CharList.IndexOf(character.ToString(), StringComparison.CurrentCultureIgnoreCase);
            }
            return(result);
        }