有什麼辦法可以將目標c中的字符串拆分爲數組嗎?我的意思是這樣的 - 輸入字符串是:0:42:值的數組(是,0,42,值)?Objective-C Split()?
回答
注意倒數是'[NSArray componentsJoinedByString:]'。 – devios1 2013-07-29 03:55:35
我有一個問題,如果我做@「你好世界」。它將返回一個3個對象的數組,其中最後一個包含@「」。我可以遍歷數組並刪除它,但有沒有更好的方法? – 2014-02-13 14:37:08
@AuRis首先嚐試從字符串中刪除空格:[string stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]; – theDuncs 2014-03-11 14:30:58
試試這個:
NSString *testString= @"It's a rainy day";
NSArray *array = [testString componentsSeparatedByString:@" "];
: [字符串componentsSeparatedByString:@」「] objectAtIndex:0];
使用這個: [[string componentsSeparatedByString:@「,」] [0];
我仍然想知道爲什麼人們回答年齡大的問題並且已經確定了答案...更不用說你們只是選擇了沒有意義的第一個元素。 – 2014-12-22 05:22:39
- 1. NumberFormatter - ObjectiveC
- 2. split()
- 3. apache camel split()vs split(body())
- 4. Swift:import ObjectiveC vs Foundation
- 5. ObjectiveC中的MulticastDelegate
- 6. 中的ObjectiveC
- 7. 在的ObjectiveC
- 8. 在的ObjectiveC
- 9. JSON ObjectiveC - 錯誤
- 10. Curl,Asana&ObjectiveC
- 11. 在的ObjectiveC
- 12. 在的ObjectiveC
- 13. split data.table
- 14. javascript split()
- 15. Pandas Split''。 「
- 16. ObjectiveC隨機數字
- 17. 突破在的ObjectiveC
- 18. ObjectiveC項目組織
- 19. ObjectiveC分配和init?
- 20. python list columns split
- 21. split oracle apex export
- 22. split()上的TypeError
- 23. Split Dartboard into Polygons
- 24. AS3 split()命令
- 25. split包含EOF?
- 26. String Split() - 方法
- 27. 問題split()
- 28. java split()方法
- 29. Splitter.fixedLength(int).split(string)
- 30. xsl:for-each Split Records
也許你應該接受這個答案? :P – Frizi 2012-02-22 14:53:29