What's the objective-C equivalent of python's os.path.join
in iOS? e.g.:
>>> import os
>>> os.path.join("foo", "bar", "buuxometer", "hi.jpg")
'foo/bar/buuxometer/hi.jpg'
You are looking for [NSString pathWithComponents] which, per the link will:
Returns a string built from the strings in a given array by concatenating them with a path separator between each pair.
In your sample:
NSArray *components = [NSArray arrayWithObjects:@"foo", @"bar", @"buuxometer", @"hi.jpg", nil];
NSString *path = [NSString pathWithComponents:components];
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