I am writing a string tokenizer in Objective-C for an iPhone application.
I have the result as:
1|101|Y|103|Y|105|Y|107|Y|109|Y|111|Y|113|Y|115|Y|
I want to tokenize this string and display each of the values in tabular format. How am I to do it?
I want the result in a tabular format. Like:
102 Y
103 Y
.. ...
If by “tokenizing” you mean simply “splitting on the pipe-sign”, you can use the componentsSeparatedByString:
method of NSString
:
NSString *original = @"1|101|Y|103|Y|105…";
NSArray *fields = [original componentsSeparatedByString:@"|"];
“Displaying in a tabular format” doesn’t say much. If you want a classic table, see the UITableView class.
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