2012-02-07 207 views
-2

我想使用Objective C将字符串作为下标追加到另一个字符串中。有谁知道我该怎么做?在另一个字符串中添加一个字符串作为下标

+0

是什么 “为标” 是什么意思?你希望它作为一个下标显示在屏幕上,还是你想像方括号中的数组下标? – 2012-02-07 08:37:32

+1

参考http://stackoverflow.com/questions/3525435/is-there-an-easy-way-to-make-part-of-an-nsstring-object-a-superscript-or-subscri – Maulik 2012-02-07 08:39:58

+0

你能举个例子吗?据我所知你有“一些很好的字符串” – Chugaister 2012-02-07 08:47:52

回答

2

如果你的意思后缀,方法如下:

NSString *foobar = [@"foo" stringByAppendingString:@"bar"]; 
+0

他的意思是说子脚本.. – 2012-02-07 09:20:12

+0

下标并不意味着任何字符串的上下文。下标是印刷效果。您可以将下标添加到标签,或添加到NSAttributedString,但不添加到NSString。 – 2012-02-07 10:04:31

+0

是的,你可以使用unicode将下标添加到nsstring – 2012-02-07 10:22:21

相关问题