This question already has answers here:
How to make subscripts and superscripts using NSAttributedString?
(5 answers)
Closed 8 years ago.
I'm currently working in Xcode with objective-c.
I have an normal NSString with a string.
Let's say the string is "Hello Stackoverflow".
Now I want to make the "Hello" piece of the string superscript, how do I do that?
UPDATE:
I want to display it in a UItextview. I tried kCTSuperscriptAttributeName from the other post, but the UItextview won't allow "NSmutableattributedstring" or "NSattributedstring".
Well you can't as NSString only holds characters, not attributes about how those characters will be displayed.
That answers the question, however my answer can be enhanced if you tell us how you intend to display the string.
Related
This question already has answers here:
In Xcode 11.1 onward, Is there any way to have different Display Name and PRODUCT_NAME?
(2 answers)
Closed 3 years ago.
In this screenshot, how did they make the app name more than 12 characters long? I know how to add a space between the words. The question is "Why app name "МойКиевстар..". truncated and "Монети Украины" not? "
"Монети Украины" - 14 characters long!
The font is not monospaced. You could achieve more than 12 characters using all “I”’s. Also note that the point at which the display name truncates will vary across devices.
This question already has answers here:
Is there any way I can define a variable in LaTeX?
(5 answers)
Closed 5 years ago.
Is there a way to add a text by reference using LaTeX? I have several text references to 'versionXX.yy'. I wonder if I can define this in one place so I don't need to update it in all places.
Thanks
You could define a variable or new command with your version at the beginning and then just use this definition. See here
Btw. there is a special site called tex.stackexchange.com for this kind of questions.
This question already has answers here:
Parsing ISO-639 language codes to show full English language names
(4 answers)
Closed 7 years ago.
I am looking for the any way to convert the ISO 639 code to the full english name.
WiKi URL ISO_639
Thanks
Just map them:
http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
Note that sometimes there are two values for Chinese, traditional and simplified.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 8 years ago.
Improve this question
I'm struggling with what I imagine is fairly simple - but I need to create a string by joining various strings and string vars together - this is what i have so far -
_msgTxt = #"I have achieved great results with my instructor%#", _usrName, #"Check her out here", _usrURL;
any tips on where i'm going wrong? I'm hoping to achieve a long string ie ' I have achieved great results with my instructor Zoe Edwards. Check her out here http://www.nme.com" which could be posted to social media channels.
Cheers
You'll need to use stringWithFormat.
Example:
_msgTxt = [NSString stringWithFormat:#"I have achieved great results with my instructor %#. Check her out here %#", _usrName, _usrURL];
One thing to keep in mind using the example above is that the objects/variables provided should appropriately use the description method to output user visible strings. NSString does, but other objects may output something which isn't user friendly.
If this is the case, you should use an NSString object within the parent object to display the information (You'd need to create this yourself; _usrURL.userFriendlyString for example).
Use [NSString stringWithFormat:*enter you stuff here*];
While stringWithFormat: will work as proposed by the other answers, it isn't very efficient if you just want to concatenate a number of strings in a set order. The power of stringWithFormat: comes from the contents of the format and the ability to reorganise and 'format' contents with the parameter specifiers. But it comes with a cost because the format string has to be parsed and processed.
For simple string concatenation, use NSMutableString and the appendString: method. (and note that you can also use appendFormat: of you have one part that needs it...).
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
Can anyone please explain the difference between this
[display setText:[[display text] stringByAppendingString:digit ]];
and this
[display setText:digit];
The code is rather clear. But if you don't understand:
Here [display setText:[[display text] stringByAppendingString:digit ]]; a new digit will be added to the digits currently displaying on the screen. This BOOL value userIsInTheMiddleOfTypingANumber is extremely straightforward - it is said that there are always digits on the screen and a new digit must be added to them. This method stringByAppendingString returns a new string made by appending a given digit to the currently displayed digits in the UITextField.
And here [display setText:digit]; all the text which are displayed in the UITextField will be overwritten with a new digit value. But as I suppose it is used when there are no digits on the screen and we need to write the first one.I don't know what is using for displaying digits in that app. But if it is UITextField then using setText is a bad idea - it is a deprecated method. You should use text property instead.
This is an extremely simple code which you need to understand yourself. So my advice you to read some introductory books on CocoaTouch and iOS with simple examples there are plenty of them: http://www.amazon.com/Beginning-iOS-Development-Exploring-SDK/dp/1430245123/ref=pd_sim_b_8 . And don't forget to use official documentation.