Link to home
Start Free TrialLog in
Avatar of Dnx_7
Dnx_7Flag for Belgium

asked on

How can i parse and check if a string is in BASE64 format?

Hi experts,

Is there a way to check/parse a string and see if it is a valid base64 ?

because i don't want to do a try/Catch, guess it will slow my system if we don't have base64 string...


Regards
Avatar of Jaime Olivares
Jaime Olivares
Flag of Peru image

You can make some checkings, like the valid characters:
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/ plus the = sign

also have a look to the following explanation about how a base64 string is made:
http://en.wikipedia.org/wiki/Base64
Avatar of Dnx_7

ASKER

Hi,

i'm agree with you but suppose the application receive a string like this : "Hello=/Script"
kind of valid base64?!

Regards.
ASKER CERTIFIED SOLUTION
Avatar of Jaime Olivares
Jaime Olivares
Flag of Peru image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Dnx_7

ASKER

Thank you!