Created
December 14, 2016 02:27
-
-
Save kasimok/66343a9d1b964209cd552d2222a98b0f to your computer and use it in GitHub Desktop.
Method to verify if a string is legal base64 encoded
This file contains hidden or 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
/** | |
* Check if valid BASE64 String. | |
* @param value | |
* @return | |
*/ | |
public static boolean checkIfValidBase64(String value){ | |
return value.matches("^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)$"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment