Search code examples
objective-ccocoa-touchunicodesuperscript

NSString: Looking for Unicode for superscript: 1, 2, 3


I am looking for the Unicode or some method or byte language that can put out superscripts for 1, 2, 3. For whatever reason Unicode has superscripts for 0, 4, 5, 6, 7, 8, 9, but not 1, 2, 3.

Can you do superscripts like HTML in NSString?


Solution

  • From the character palette:

    ¹
    SUPERSCRIPT ONE
    Unicode: U+00B9, UTF-8: C2 B9
    
    ²
    SUPERSCRIPT TWO
    Unicode: U+00B2, UTF-8: C2 B2
    
    ³
    SUPERSCRIPT THREE
    Unicode: U+00B3, UTF-8: C2 B3
    

    This, to make them in to NSStrings, you'd do:

    NSString *superscript1 = @"\u00B9";
    NSString *superscript2 = @"\u00B2";
    NSString *superscript3 = @"\u00B3";