
方法一适用于数组,方法二适用于数组和字典。xxx用你自己定义的数组名或者字典名替换即可。
方法一:
if xxx.isEmpty
{ println( "xxx 为空")
}
else
{
println(“xxx 不为空”)
}
// 字典元素个数为零
方法二:
if xxx.count == 0
{ println( "xxx 为空")
}
else
{
println(“xxx 不为空”)
}
方法一适用于数组,方法二适用于数组和字典。xxx用你自己定义的数组名或者字典名替换即可。
方法一:
if xxx.isEmpty
{ println( "xxx 为空")
}
else
{
println(“xxx 不为空”)
}
// 字典元素个数为零
方法二:
if xxx.count == 0
{ println( "xxx 为空")
}
else
{
println(“xxx 不为空”)
}
本文标题:oc 中,数组和字典元素为空的判断
本文链接:https://www.haomeiwen.com/subject/fpcykttx.html
网友评论