Skip to content

Commit

Permalink
bump: 0.0.2
Browse files Browse the repository at this point in the history
  • Loading branch information
gabriel-logan committed Jul 10, 2024
1 parent 761f3e6 commit a7d767f
Show file tree
Hide file tree
Showing 24 changed files with 328 additions and 99 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file.
10 changes: 9 additions & 1 deletion .idea/sonarlint/issuestore/index.pb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file.
Empty file.
Empty file.
Empty file.
10 changes: 9 additions & 1 deletion .idea/sonarlint/securityhotspotstore/index.pb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

124 changes: 124 additions & 0 deletions .idea/uiDesigner.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 19 additions & 4 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import io.github.multiform_validator.Validator;
import io.github.multiform_validator.EmailValidator;
import io.github.multiform_validator.CpfValidator;
import io.github.multiform_validator.CnpjValidator;
import io.github.multiform_validator.Utils;

public class Main {
public static void main(String[] args) {
Expand All @@ -32,6 +33,13 @@ public class Main {

System.out.println(Validator.isAscii("foo")); // true
System.out.println(Validator.isAscii("foo©")); // false

System.out.println(Utils.getOnlyEmail("This is an example [email protected] bla yes my friend loren ipsun")); // [email protected]
System.out.println(Utils.getOnlyEmail("This is an example bla yes my friend loren ipsun")); // null
// With options
Utils.GetOnlyEmailOptionsParams options = new Utils.GetOnlyEmailOptionsParams();
options.multiple = true;
System.out.println(Utils.getOnlyEmail("This is an example [email protected] bla [email protected] yes yes", options)); // [[email protected], [email protected]]
}
}
```
Expand Down
2 changes: 1 addition & 1 deletion multiform-validator.iml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<module version="4">
<component name="SonarLintModuleSettings">
<option name="uniqueId" value="87b94a39-8d05-4761-9afa-26b585acd5d2" />
<option name="uniqueId" value="c5c54ae9-3385-42e1-a3bd-58c981c046ca" />
</component>
</module>
3 changes: 2 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>io.github</groupId>
<artifactId>multiform-validator</artifactId>
<version>0.0.1</version>
<version>0.0.2</version>

<name>Multiform Validator</name>
<description>
Expand All @@ -31,6 +31,7 @@
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
<dependency>
<groupId>org.jetbrains</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ public static boolean cnpjIsValid(String cnpj) {
return false;
}

// Check if all digits are the same
if (cnpjClean.chars().distinct().count() <= 1) {
return false;
}

// Convert the string to an array of integers
final int[] cnpjArray = cnpjClean.chars().map(Character::getNumericValue).toArray();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public static boolean isEmail(String email) {
throw new NullPointerException("Email cannot be null");
}

final Pattern startsWithSpecialChar = Pattern.compile("^[^a-zA-Z0-9]");
final Pattern startsWithSpecialChar = Pattern.compile("^[^a-zA-Z]");

if (startsWithSpecialChar.matcher(email).find()) {
return false;
Expand Down
Loading

0 comments on commit a7d767f

Please sign in to comment.