How do I include superscripts in NSString?

2019-07-23 00:05发布

Is there any way I can include a superscript with NSString? For example, I want to write square feet, like this: foot2.

标签: nsstring
1条回答
ら.Afraid
2楼-- · 2019-07-23 00:52

In this particular case, there is in fact a single Unicode character that represents a small "2" written above the line. It is U+00B2 (Superscript Two).

You should be able to do something like:

NSString *aString = [NSString stringWithUTF8String:"foot\u00b2"];
查看更多
登录 后发表回答