krot

is_base64

Jun 12th, 2020
1,109
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -module(m).
  2.  
  3. -export([is_base64/1 ]).
  4.  
  5. %%is_base64
  6. is_base64([])->false;
  7. is_base64(L) when is_list(L)->is_base64_ev(L);
  8. is_base64(L) when is_binary(L)->is_base64_ev(binary_to_list(L));
  9. is_base64(_)->false.
  10.  
  11. is_base64_ev([])->true;
  12. is_base64_ev([C|_H]) when
  13.                 ((C <$0) orelse  (C >$9)) andalso
  14.                 ((C < $a) orelse (C > $z))andalso
  15.                 ((C < $A) orelse (C > $Z))andalso
  16.                 (C /= $+)andalso
  17.                 (C /= $/)andalso
  18.                 (C /= $= )
  19.                 ->false;
  20. is_base64_ev([_C|H])->is_base64_ev(H).
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×