anyone here got a function to find is a string is base64 encoded?
Wouter
wouter.abraham at pi.be
Sun Jul 25 17:33:43 EDT 2004
>
> • From: Andre Garzia
> • Subject: Re: anyone here got a function to find is a string is
> base64 encoded?
> • Date: Sun, 25 Jul 2004 14:05:55 -0700
>
>
> Wouter and All,
>
> thank you very much for all your replies! Noew thanks to this
> function, we can probe a string to see if it is Base64 encoded and add
> it as a <base64> item in the XML-RPC Lib!
>
>
> Thanks
> andre
Tnx, but I should learn to use the find and replace instead of
replacing by hand and watching movies, damn me...as you all have seen
already
> One could test for a *welformed* base64Encodeded string :
>
> function isWelformed64 pText
> replace cr with "" in pText
if the num of chars in pText 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 once again.
Greetings,
WA
More information about the use-livecode
mailing list