问题描述
之前可能有人问过这个问题,但没有完全找到......或者我发现的东西很旧。
难道没有一个 CFML 函数可以让我检查“[email protected]”是否已经存在于“toAddress”的任何结构下?我显然可以循环我的数组,如果找到则检查并中断,但想知道是否已经存在某些东西?
谢谢。 拍
解决方法
您可以将 arrayFind()
与回调函数一起使用。使用上面的数据结构并假设数组名为 myArray
if(
!arrayFind( myArray,function( item ){
return item.toAddress == '[email protected]'
})
){
// do stuff if address is not used.
}