private bool IsBaseX(char character, int numBase) { const string CharList = "0123456789abcdefghijklmnopqrstuvwxyz"; var index = CharList.IndexOf(character.ToString(), StringComparison.CurrentCultureIgnoreCase); return(index >= 0 && index < numBase); }
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); }