views:

21

answers:

1

Hi All, Coming across from vb.net to iphone. Im currently trying to iterate through a string to pull values out of it. I have the following example string:

Field1ExampleField2ExampleField1ExampleField2Example

So basically i want to loop through the string and put the Field1 and Field2 of each value into a list.

In VB i would:

while str <> "" dim CurrentStringValue as string = "" 'SET THE CURRENTSTRINGVALUE TO BE to 'Remove that string from the looping string "str" 'Use substring to pull the values out of field1 and field2 and pump it into a list end while

Any ideas on how this would basically be done in objective c?

Thanks

+1  A: 

If you are looking to parse XML, you should look at this link about XML parsing in iPhone applications.

From the first version of your question:

You can try this:

NSString *allValuesString = @"NField1ExampleField2ExampleField1ExampleField2Example";
NSArray *allValues = [allValuesString componentsSeparatedByString:@"Example"];
Chris Cooper