问题
What is the best way to convert from char * to an instance of NSString?
I used the method -stringWithUTF8String:, but it's not good: the result contains "\n" at the end!
回答1:
Create the string using the same method you're using now. Then, use a method like -stringByTrimmingCharactersInSet: to create the trimmed string that you really want.
来源:https://stackoverflow.com/questions/6325993/convert-from-char-to-nsstring