2010-07-14 54 views
0

從vb.net到iphone。我目前正試圖迭代通過一個字符串來拉出值。我有以下的例子字符串:iphone字符串操作

Field1ExampleField2ExampleField1ExampleField2Example

所以基本上我想通過串迴路,把字段1和Field2每個值到一個列表。

在VB我將:

而STR <> 「」 暗淡CurrentStringValue爲字符串= 「」 '設置CURRENTSTRINGVALUE TO BE到 ' 從循環字符串 「STR」 刪除該字符串 「使用子字符串將field1和field2中的值拉出,並將其抽成列表 結束,而

有關如何在基本上在目標c中完成的任何想法?

感謝

+0

的例子字符串得到了由計算器改變。 「 Field1Example Field2Example Field1Example Field2Example」 – BennyBoy 2010-07-14 01:59:16

+0

點擊 「編輯」,以糾正實際問題 – 2010-07-14 02:00:58

回答

1

如果您正在尋找解析XML,你應該看看this link about XML parsing in iPhone applications

從你的問題的第一個版本:

你可以試試這個:

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