iOS十进制转62进制

base62ForObject-C

+ (NSMutableString *)base62Encode:(long long int)num

{
    NSString *alphabet = @"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
       
        NSMutableString *str = [[NSMutableString alloc] init];
        while (num > 0) {
            [str appendString:[alphabet substringWithRange:NSMakeRange(num % 62, 1 )]];
            num /= 62;
        }
        return str;

}

你可能感兴趣的:(ios)