通過使用目標C我有過濾一年陣列使用NSPredicate,如何過濾字符串數組中的斯威夫特
下面是代碼。
yearArray = [yearArray filteredArrayUsingPredicate:[NSPredicate
predicateWithFormat:@"SELF != ''"]];
按照上面的代碼它的工作目標C細,我一定要在斯威夫特3,濾波器陣列
什麼是輸入年份陣列: -
(Year,"","","",JAN,"","","",FEB,"","","",MAR,"","","",APR,"","","",
MAY,"","","",JUN,"","","",JUL,"","","",AUG,"","","",SEP,"","","",OCT
,"","","", NOV,"","","",DEC,"","","","",WIN,"","","",SPR,"","","",SUM
,"","","",AUT,"","","","",ANN)
Need filter Output Array
(Year,JAN,FEB,MAR,APR,MAY,JUN,JUL,AUG,SEP,OCT,NOV,DEC,WIN,SPR,SUM,AUT,ANN)
請給解決方案如何快速過濾數組。
我用你的代碼,但是它的示值誤差,表達的類型是沒有更多的上下文曖昧。 –
是你的[String]類型還是不同的數組? –
字符串類型的NSMutableArray –