十进制和36进制之间的转换
/**
*十进制长整型变量转换36进制字符串
*
*@paramdecimal 10进制长整型
*
*@return36进制字符串
*/
+ (NSString*)decimal2ThirtySix:(unsignedlonglong)decimal
{
NSMutableString* dd = [NSMutableStringstring];
NSString* parma =@"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
unsignedlonglongi = decimal;
while(i>0){
intc = i%36;
i = i/36;
charcc = [parmacharacterAtIndex:c];
[ddinsertString:[NSStringstringWithFormat:@"%c",cc]atIndex:0];
}
returndd;
}
/**
* 36进制字符串转换10进制长整型变量
*
*@paramthirtySixStr 36进制字符串
*
*@return10进制长整型变量
*/
+ (unsignedlonglong)thirtySix2Decimal:(NSString*)thirtySixStr{
NSString*str36 = [thirtySixStrcopy];
unsignedlonglongcou=0;
unsignedlonglength = [str36length];
for(unsignedlongj = length ; j>0;j--) {
charc = [str36characterAtIndex:j-1];
if(c>='0'&&c<='9'){
cou = cou+(c-'0')*pow(36,(length-j));
}elseif(c>='a'&&c<='z'){
cou = cou+(c-'a'+10)*pow(36,(length-j));
}
}
returncou;
}