1

Is it possible to have exponents in an NSString object that will be displayed in a UITextField and a UILabel? If so, how do we do it? If not, any alternatives you might suggest?

4
  • Are you talking about superscript? Jan 23, 2013 at 21:49
  • Yes superscript would be perfect!
    – Alex
    Jan 23, 2013 at 21:51
  • Check this answer stackoverflow.com/a/12813254/1730272
    – iDev
    Jan 23, 2013 at 22:04
  • thanks, i was looking for something like that!
    – Alex
    Jan 24, 2013 at 3:03

1 Answer 1

3

As answered by jrturton in this question:

You need to include the unicode symbol for a superscripted character:

NSInteger number = 10; 
NSString *cubedSymbol = @"\u00B3";
NSString *tenCubed = [NSString stringWithFormat:@"%d%@",number,cubedSymbol];

Plenty more fun is to be had here

2
  • that would work, is there a way to write whatever number i want in superscript?
    – Alex
    Jan 23, 2013 at 21:52
  • From what I can find, it sounds like it's possible but not as easy. Check out this question and this question for the specifics. Jan 23, 2013 at 21:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.