objective c - Cannot strip newline from Cocoa NSMutableString -
Hey, for my life, it's not working: ..
NSMutableString * B64String = [[[NSMutableString alloc] initWithFormat: @ "Basic% @", [string_base64 encoding: string]] autorege]; [B64 string string bitimating customer inset: [NSCRTitreatersSatNewelCarCarSat]]; NSLog (@ "(% @)", B64 string); NSRange found range = [b64String rangeOfString: @ "\ n"]; If (foundRange.location! = NSNotFound) [B64 string stringearplying ocransoffstring: @ "\ n" with string: @ "" option: 0 range: mixed range]; NSLog (@ "(% @)", B64 string);
In both the ways that I found - and they do not work ... I have to do something wrong. But, if I break on NSLog, I can clearly see "\ n" (in the debugger and in the console) in the string
Besides, this is true:
If (foundRange.location! = NSNotFound)
and I can see that string bayer rehearsing octersonationofstrings method ...
< Div class = "Post-text" itemprop = "text">
Just call
b64String = [b64String stringByReplacingOccurrencesOfString: @ "\ n" with string: @ "" ]
is sufficient ( -release
to b64strin G
. You want to store it in another variable), or you can actually use the completely unstable method Category:
[ B64String replaceOccurrencesOfString: @ "\ n" with string: @ "" option: 0 category: nsmkrange (0, [b64 string length]]]; -stringByReplacingOccurrencesOfString: withString: Option: Category:
, category
parameter specifies the category where the replacement occurs. In
This means that nothing will change outside the boundary. In your code, you pass the first format of the \ n
only the 1 event of the effect \ n
will be deleted.
string By ...
Methods that are for an unchanging string will not modify the input string. Instead, they copy the irreversible string and return the modified copy.
Comments
Post a Comment