Using the following doesn't work:
- (NSString *)stringByReplacingOccurrencesOfString:(NSString *)target withString:(NSString *)replacement
By doesn't work I mean does not do any replacement what so ever. It returns the same exact string.
Is there a convenience method to do this? Similar to:
- (NSString *)stringByReplacingPercentEscapesUsingEncoding:(NSStringEncoding)encoding
My code (just one line):
NSString *escapedPath = [pathToBeConverted stringByReplacingOccurrencesOfString:@" "
withString:@"\ "];
Also, my compiler warning. Which likely has much to do with this:
warning: unknown escape sequence: '\040'
You should use @"\\ "
instead of @"\ "
. In C \
is the escape character. You need to escape it with another \
.
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