Toggle navigation
Toggle navigation
This project
Loading...
Sign in
flutter_package
/
fluttertpc_get
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Kauê Murakami
2020-07-06 13:08:30 -0300
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
4e0058503dce64004e02e79d74ba304d9f8eb257
4e005850
1 parent
dd7f7e09
adicionando função isCpf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
0 deletions
lib/src/regex/get_utils.dart
lib/src/regex/get_utils.dart
View file @
4e00585
...
...
@@ -293,6 +293,20 @@ class GetUtils {
/// Checks if num a EQUAL than num b.
static
bool
isEqual
(
num
a
,
num
b
)
=>
a
==
b
;
/// Checks if the cpf is valid.
static
bool
isCpf
(
String
cpf
){
if
(
cpf
==
null
)
return
false
;
// get only the numbers
var
numeros
=
cpf
.
replaceAll
(
RegExp
(
r'[^0-9]'
),
''
);
// Test if the CPF has 11 digits
if
(
numeros
.
length
!=
11
)
return
false
;
// Test if all CPF digits are the same
if
(
RegExp
(
r'^(\d)\1*$'
).
hasMatch
(
numeros
))
return
false
;
return
true
;
}
/// Capitalize each word inside string
/// Example: your name => Your Name, your name => Your name
///
...
...
Please
register
or
login
to post a comment