开发者

action script string masking function

Following is a php functi开发者_如何学JAVAon for masking a string. Can somebody give me the actionscript equalent for this function.

public static function simple_encrypt($input) {
        $return = array();
        for($i = 0; $i < strlen($input); $i++){
            $ascii = ord(substr($input, $i, 1)) * 2;
            $return[] = base_convert($ascii, 10, 32);
        }
        return sprintf('RL%s', implode('', $return) ); // "RL" ensures it starts with a letter
}


public static function simple_encrypt(input:String):String {
        var ret = [];
        var ascii:Number;
        for(var i:Number = 0; i < input.length; i++) {
            ascii = input.charCodeAt(i) * 2;
            ret.push(ascii.toString(32));
        }
        //I don't speak php, so I am assuming that 
        //RL doesn't have any syntactical meaning with sprintf
        return "RL" + ret.join(''); //joins everything to a single string.
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜