-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #379 from nilsonLazarin/gabriel
Alterações realizadas no sistema entre os dias 09/05 e 20/05/2024
- Loading branch information
Showing
25 changed files
with
2,125 additions
and
2,156 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
function testaCPF(strCPF) { | ||
var strCPF = strCPF.replace(/[^\d]+/g, ''); // Limpa a string do CPF removendo espaços em branco e caracteres especiais. | ||
var Soma; | ||
var Resto; | ||
Soma = 0; | ||
if (strCPF == "00000000000") return false; | ||
|
||
for (i = 1; i <= 9; i++) Soma = Soma + parseInt(strCPF.substring(i - 1, i)) * (11 - i); | ||
Resto = (Soma * 10) % 11; | ||
|
||
if ((Resto == 10) || (Resto == 11)) Resto = 0; | ||
if (Resto != parseInt(strCPF.substring(9, 10))) return false; | ||
|
||
Soma = 0; | ||
for (i = 1; i <= 10; i++) Soma = Soma + parseInt(strCPF.substring(i - 1, i)) * (12 - i); | ||
Resto = (Soma * 10) % 11; | ||
|
||
if ((Resto == 10) || (Resto == 11)) Resto = 0; | ||
if (Resto != parseInt(strCPF.substring(10, 11))) return false; | ||
return true; | ||
} |
Oops, something went wrong.