Advertisement
krot

is_base64

Jun 12th, 2020
4,282
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Erlang 0.38 KB | None | 0 0
  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).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement