开发者

Problem trying to translate "+" into character +

I'm having a problem trying to convert a character into a string in Xcode. Here's my code...

NSString *temp = [NSString stringWithFormat:@"%@  %@  %@ = %@", inputOne.text, sign.text, inputTwo.text, answer.text];

self.sign.text is supposed to return either a "+", "-", "*", or "/", which it does. However, I'm trying to have the user post one of these back into facebook via the ap开发者_如何学编程p. All but the "+" sign will load as a string when they post it to their wall. I don't understand how to get the "+" to show.

I'm guessing that this gets lost since the "+" has a different meaning in javascript. How can I make it a string character in my NSString so that it accepts when posting. Hope this made sense.


I know you can put a quotation mark into a textView by placing a "\" before the quotation. This may work with a "+" sign as well. So the string would look something like this:

@"This is a plus sign \+ in a textView"

Which would return

This is a plus sign + in a textView


Sending "+" over the net (e.g. in GET or, I think, POST) will convert "+" into a space character. To fix, you need to escape the "+" using "%2B".

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜