anyone here got a function to find is a string is base64 encoded?

Wouter wouter.abraham at pi.be
Sun Jul 25 16:19:03 EDT 2004


--snip

Oops typo

> One could  test for a *welformed* base64Encodeded string :
>
> function isWelformed64 pText
>   replace cr with "" in pText
>   if the num of chars in tText mod 4 = 0 then
>      repeat for each char i in pText
>       put i into tArray[i]
>     end repeat

     put the keys of tArray into tKeys

>     if "=" is in tKeys then
>       put the num of chars in pText - 1 into x
>       put 1 into tC
>       repeat for each char i in pText
>         if  i = "=" and tC < x then return false
>         add 1 to tC
>       end repeat
>     end if
>     repeat for each line i in tKeys
>       if i is not in "abcdefghijklmnopqrstuvwxyz1234567890/=" then 
> return false
>     end repeat
>     return true
>   else return false
> end isWelformed64
>
>

Sorry,
Greetings,
WA



More information about the use-livecode mailing list