">} outputstring;
} * decimal_to_binary (NSString * str) {inNumber; * outputString;=@ raquo ;; temp;=[str integerValue]; (inNumber!=0) {= inNumber% 2;= (inNumber-temp)/2;=[NSString stringWithFormat: @ % i% @ raquo ;, temp, outputString];
} outputString;
} * decimal_to_octal (NSString * str) {= [NSString stringWithFormat: @ % o raquo ;, [str intValue]]; str;
} * decimal_to_hex (NSString * str) {= [NSString stringWithFormat: @ 0x% X raquo ;, [str integerValue]]; str;
}
* hex_to_bin (NSString * str) {= [str uppercaseString]; * hexMap=[NSDictionary dictionaryWithObjectsAndKeys:
@ +0000 raquo ;, @ 0 ,
@ 0001 raquo ;, @ 1 ,
@ +0010 raquo ;, @ 2 ,
@ +0011 raquo ;, @ 3 ,
@ +0100 raquo ;, @ 4 ,
@ 0101 raquo ;, @ 5 ,
@ 0110 raquo ;, @ 6 ,
@ 0111 raquo ;, @ 7 ,
@ 1 000 raquo ;, @ 8 ,
@ +1001 raquo ;, @ 9 ,
@ 1010 raquo ;, @ A ,
@ +1011 raquo ;, @ B ,
@ 1100 raquo ;, @ C ,
@ 1 101 raquo ;, @ D ,
@ 1110 raquo ;, @ E ,
@ 1 111 raquo ;, @ F ,]; * result=[NSMutableString string]; (NSUInteger i=0; i!=[str length]; i ++) {* hexDigit= [str substringWithRange: NSMakeRange (i, 1)];
[result appendString: [hexMap objectForKey: hexDigit]];
} result;
} * return_only_number (NSString * str) {* number_str=@ raquo ;; (int k=0; k!=[str length]; k ++) {(isdigit ([str characterAtIndex: k])) {_str=[NSString stringWithFormat: @ % @% @ raquo ;, number_str, [str substringWithRange: NSMakeRange (k, 1)]];// add symbol to a new number string
}
} number_str;
} test_to_bin (NSString * str) {(int k=0; k!=[str length]; k ++) {([[str substringWithRange: NSMakeRange (k, 1)] intValue] gt; =2) {false;
}
} true;
} test_to_octal (NSString * str) {(int k=0; k!=[str length]; k ++) {([[str substringWithRange: NSMakeRange (k, 1)] intValue] gt; =8) {false; true; * return_hex (NSString * str) {= [str uppercaseString]; * hex_str=@ raquo ;; number_charachter=0; (int k=0; k!=[str length]; k ++ ) {_charachter=[str characterAtIndex: k]; (isdigit ([str characterAtIndex: k]) || (number_charachter gt;=65 amp; amp; number_charachter lt;=70)) {_str=[NSString stringWithFormat: @ % @% @ raquo ;, hex_str, [str substringWithRange: NSMakeRange (k, 1)]]; hex_str;
}
@ end