/// <summary> /// Validar documento e calcular o digito /// </summary> /// <param name="document"></param> /// <returns></returns> public string CalcDigit(string document) { string doc = document.Trim().Replace(".", "").Replace("-", "").Replace("/", ""); string ret = string.Empty; if (doc.Length == 11) { ret = new CPF().CalcDigCPF(doc); } else if (doc.Length == 14) { ret = new CNPJ().CalcDigCNPJ(doc); } return(ret); }