forked from marcwrobel/jbanking
-
Notifications
You must be signed in to change notification settings - Fork 0
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 marcwrobel#177 from marcwrobel/170-bic-regex
Get rid of regexes in Bic
- Loading branch information
Showing
7 changed files
with
157 additions
and
23 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
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
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
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
113 changes: 113 additions & 0 deletions
113
src/main/java/fr/marcwrobel/jbanking/internal/AsciiCharacters.java
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,113 @@ | ||
package fr.marcwrobel.jbanking.internal; | ||
|
||
/** | ||
* Code from this class is an adaptation of <a href="https://commons.apache.org/proper/commons-lang/">Apache commons-lang</a> | ||
* {@code CharUtils}. | ||
*/ | ||
public class AsciiCharacters { | ||
|
||
/** | ||
* <p> | ||
* Checks whether the character is ASCII 7 bit alphabetic. | ||
* </p> | ||
* | ||
* <pre> | ||
* CharUtils.isAsciiAlpha('a') = true | ||
* CharUtils.isAsciiAlpha('A') = true | ||
* CharUtils.isAsciiAlpha('3') = false | ||
* CharUtils.isAsciiAlpha('-') = false | ||
* CharUtils.isAsciiAlpha('\n') = false | ||
* CharUtils.isAsciiAlpha('©') = false | ||
* </pre> | ||
* | ||
* @param c the character to check | ||
* @return true if between 65 and 90 or 97 and 122 inclusive | ||
*/ | ||
public static boolean isAlphabetic(final char c) { | ||
return isUpperAlphabetic(c) || isLowerAlphabetic(c); | ||
} | ||
|
||
/** | ||
* <p> | ||
* Checks whether the character is ASCII 7 bit alphabetic upper case. | ||
* </p> | ||
* | ||
* <pre> | ||
* CharUtils.isAsciiAlphaUpper('a') = false | ||
* CharUtils.isAsciiAlphaUpper('A') = true | ||
* CharUtils.isAsciiAlphaUpper('3') = false | ||
* CharUtils.isAsciiAlphaUpper('-') = false | ||
* CharUtils.isAsciiAlphaUpper('\n') = false | ||
* CharUtils.isAsciiAlphaUpper('©') = false | ||
* </pre> | ||
* | ||
* @param c the character to check | ||
* @return true if between 65 and 90 inclusive | ||
*/ | ||
public static boolean isUpperAlphabetic(final char c) { | ||
return c >= 'A' && c <= 'Z'; | ||
} | ||
|
||
/** | ||
* <p> | ||
* Checks whether the character is ASCII 7 bit alphabetic lower case. | ||
* </p> | ||
* | ||
* <pre> | ||
* CharUtils.isAsciiAlphaLower('a') = true | ||
* CharUtils.isAsciiAlphaLower('A') = false | ||
* CharUtils.isAsciiAlphaLower('3') = false | ||
* CharUtils.isAsciiAlphaLower('-') = false | ||
* CharUtils.isAsciiAlphaLower('\n') = false | ||
* CharUtils.isAsciiAlphaLower('©') = false | ||
* </pre> | ||
* | ||
* @param c the character to check | ||
* @return true if between 97 and 122 inclusive | ||
*/ | ||
public static boolean isLowerAlphabetic(final char c) { | ||
return c >= 'a' && c <= 'z'; | ||
} | ||
|
||
/** | ||
* <p> | ||
* Checks whether the character is ASCII 7 bit numeric. | ||
* </p> | ||
* | ||
* <pre> | ||
* CharUtils.isAsciiNumeric('a') = false | ||
* CharUtils.isAsciiNumeric('A') = false | ||
* CharUtils.isAsciiNumeric('3') = true | ||
* CharUtils.isAsciiNumeric('-') = false | ||
* CharUtils.isAsciiNumeric('\n') = false | ||
* CharUtils.isAsciiNumeric('©') = false | ||
* </pre> | ||
* | ||
* @param c the character to check | ||
* @return true if between 48 and 57 inclusive | ||
*/ | ||
public static boolean isNumeric(final char c) { | ||
return c >= '0' && c <= '9'; | ||
} | ||
|
||
/** | ||
* <p> | ||
* Checks whether the character is ASCII 7 bit numeric. | ||
* </p> | ||
* | ||
* <pre> | ||
* CharUtils.isAsciiAlphanumeric('a') = true | ||
* CharUtils.isAsciiAlphanumeric('A') = true | ||
* CharUtils.isAsciiAlphanumeric('3') = true | ||
* CharUtils.isAsciiAlphanumeric('-') = false | ||
* CharUtils.isAsciiAlphanumeric('\n') = false | ||
* CharUtils.isAsciiAlphanumeric('©') = false | ||
* </pre> | ||
* | ||
* @param c the character to check | ||
* @return true if between 48 and 57 or 65 and 90 or 97 and 122 inclusive | ||
*/ | ||
public static boolean isAlphanumeric(final char c) { | ||
return isAlphabetic(c) || isNumeric(c); | ||
} | ||
} |
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
4 changes: 4 additions & 0 deletions
4
src/main/java/fr/marcwrobel/jbanking/internal/package-info.java
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,4 @@ | ||
/** | ||
* Classes in this package are for jbanking internal use only: do not use them ! | ||
*/ | ||
package fr.marcwrobel.jbanking.internal; |