I think the easiest and fastest way is to just try and decode it and catch
falure. If it fails, it is not base64 or is invalid base64 for some reason.
Then you can tell in 1 pass. If you try to walk it first just see if it is
valid, you end up with 2 passes (1 for the test and 1 for the actual
decode) - so IMO, it is not worth it anyway.
--
William Stacey [MVP]
| Is there some way to programatically tell if a string is base64 encoded?
|
|