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!
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With