Sunday, December 7, 2008

Is Base64String

This is a function to check is the string base64 string or not.




public static bool IsBase64String(string s)
{
if ((s.Length % 4) != 0)
{
return false;
}
try
{
MemoryStream stream = new MemoryStream(Convert.FromBase64String(s));
return true;
}
catch
{
return false;
}
}








keys: c#, base64, crypto,

No comments: