Objective-C Language NSString Splitting If you need to split on a set of several different delimiters, use -[NSString componentsSeparatedByCharactersInSet:] . If you need to break a string into its individual characters, loop over the length of the string and convert each character into a new string.
Creating NSArray Objects Using Array Literals In addition to the provided initializers, such as initWithObjects: , you can create an NSArray object using an array literal. In Objective-C, the compiler generates code that makes an underlying call to the init(objects:count:) method.
A static, plain-text Unicode string object that bridges to String ; use NSString when you need reference semantics or other Foundation-specific behavior.
How can I split the string @"Hello"
to either:
'H'
, 'e'
, 'l'
, 'l'
, 'o'
or:
@[@"H", @"e", @"l", @"l", @"o"]
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