I'm moving over from PHP and getting stuck into Objective-C.
One thing I am trying to rewrite is a custom BASE64 function.
How would this be written in Obj-C?
One thing I am trying to rewrite is a custom BASE64 function.
How would this be written in Obj-C?
PHP:
public static function decode($string, $key=hYc87.@.l_D3d-)
{
$result = '';
$string = str_replace(' ', '+', $string);
$string = base64_decode($string);
$string = str_replace($key, '', $string);
for($i=0; $i<strlen($string); $i++) {
$char = substr($string, $i, 1);
$keychar = substr($key, ($i % strlen($key))-1, 1);
$char = chr(ord($char)-ord($keychar));
$result.=$char;
}
return $result;
}