NSString中的指数 [英] Exponents in NSString

查看:55
本文介绍了NSString中的指数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在NSString对象中是否有指数,该指数将显示在UITextField和UILabel中?如果是这样,我们该怎么做?如果没有,您可能会建议其他选择吗?

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?

推荐答案

您需要为上标字符添加unicode符号:

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

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

还有更多乐趣这里

这篇关于NSString中的指数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆