"&#34 ;, "&#34 ;, "&#34 ;, "&#34 ;, "&#34 ;, "&#34 ;, "&#34 ;, "&#34 ;, "&#34 ;, "&#34 ;, "&#34 ;, "&#34 ;, "&#34 ;, "&#34 ;, "&#34 ;, "&#34 ;, " \" 22.6926798 \"&#34 ;, "&#34 ;, "&#34 ;, "&#34 ;, "&#34 ;, "&#34 ;, "&#34 ;, "&#34 ;, " \" 22.6925942 \"&#34 ;, "&#34 ;, "&#34 ;, "&#34 ;, "&#34 ;, "&#34 ;, "&#34 ;, "&#34 ;, " \" 22.6879868 \"&#34 ;, "&#34 ;, "&#34 ;, "&#34 ;, "&#34 ;, "&#34 ;, "&#34 ;, "&#34 ;, " \" 22.6862004 \"&#34 ;, "&#34 ;, "&#34 ;, "&#34 ;, ""
所有""是空的。如何分割和存储真正价值的另一个nsmutablearry
答案 0 :(得分:0)
如果你正在使用 Swift 3.0 。
func excludingEmptyString(_ strings : [String]) -> [String]
{
var new = [String]()
for each in strings
{
if each.characters.count > 0
{
new.append(each)
}
}
return new
}
并像这样打电话给func excludingEmptyString()
let strings = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "\"22.6926798\",", "", "", "", "", "", "", "", "\"22.6925942\",", "", "", "", "", "", "", "", "\"22.6879868\",", "", "", "", "", "", "", "", "\"22.6862004\"", "", "", "", "" ]
print(excludingEmptyString(strings))