Repositorio
Video 4044 - windev webdev Mobile - Validar Cpf
00:00:00 Introducao
00:00:07 no Windev criar window para pedir o cpf
00:00:22 Criando a procedure e codigo valida cpf
00:02:39 Voltando a window digita cpf e chamar a procedure
00:03:48 Executando e testando cpf
00:04:02 fazer cpf dentro do windev mobile
00:05:35 fazer cpf dentro do webdev
00:07:02 Propaganda wxsolucoes
00:07:24 Progranda Erpmatos
00:07:33 Representantes erpmatos
00:07:36 Video encerramento
=======================================================
validar_cpf(pCpf is string)
_CPF is string
_Peso is 2-byte unsigned int
_Resto is 1-byte int
_Digito is 1-byte int
FOR i=1 _TO_ Length(pCpf)
IF 47 < Asc(pCpf[[i]]) < 58 THEN
_CPF+=pCpf[[i]]
END
END
IF Length(_CPF) <> 11 THEN RESULT False
FOR i=1 TO 10
_Peso = _Peso + (Asc(_CPF[[1 TO 10]][[i]]) -48) * (10-i+2)
END
_Resto = modulo(_Peso,11)
IF _Resto < 2 THEN
_Digito = 0
ELSE
_Digito = 11 - _Resto
END
IF Val(_CPF[[11]]) <> _Digito THEN
RESULT False
ELSE
RESULT True
END
====================================