iOS_二級制轉十進制
- (NSInteger)toDecimalSystemWithBinarySystem:(NSString *)binary { int ll = 0 ; int temp = 0 ; for (int i = 0; i < binary.length; i ++) { temp = [[binary substringWithRange:NSMakeRange(i, 1)] intValue]; temp = temp * powf(2, binary.length - i - 1); ll += temp; } NSString * result = [NSString stringWithFormat:@"%d",ll]; return [result integerValue] ; }