'Style' may be the wrong word but what I am looking for is the ability to manipulate a NSString based on it content.
For example, I have a plist that has a string value that is changeable and I am looking to make it in a list form. So if the string was marked up with a seperator of some sort would you be able to manipulate the output.
Basically looking to make a single string like this.
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commod
into this:
- Lorem ipsum dolor sit amet,
- List item
- consectetur adipisicing elit, sed do
- eiusmod tempor incididunt ut
Is this even possible from a single string? Im sorry if this is a stupid question.
You can try below method for this. The parameter "plistString" is the original string read from plist file and "separator" is the string used as separator to divide the string.
-(NSArray*) componentsInString:(NSString*)plistString separatedBy:(NSString*)separator{
if (separator == nil)
return nil; // Choose if you want to return nil or return an array with plistString object.
NSArray *components = [plistString componentsSeparatedByString:separator]; // separator can't be nil else an unhandled exception is raised by NSString class.
return components;
}