我有一个包含许多物品的容器,其中一些物品是容器。而且我需要得到那些内部容器。最佳实践是什么?
我的解决方案对我来说有点难看:(
container a = [1, 2, ["one","two","three"]];
container b;
int i;
;
for (i = 1; i <= conLen(a); i++)
{
try
{
b = conPeek(a, i);
info(strFmt("%1", conPeek(b,1)));//here should be some logic with b items
}
catch
{
info(strFmt("NOT A CONTAINER %1", conPeek(a, i)));
}
}
提前致谢!
好的,这真的很容易。但是也许将来对某人会有帮助。
if(typeOf(conPeek(a, i)) == Types::Container)
{
b = conPeek(a, i);
info(strFmt("%1", conPeek(b,1)));
}
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句