Determines if all elements of a string satisfy a given condition. Will return TRUE
is all elements meet the condition, else FALSE
.
stringEvery(string,callback)
→ returns boolean
string.every(callback)
callback(element,index,string)
.
structEvery()
and arrayEvery()
.
Do all letters in the string meet the callback condition?
letters="ZZazz";
callback=function(inp){return inp=="z";}
allZs = StringEvery(letters,callback);
writeOutput(allZs)
Expected Result: NO
Do all letters in the string meet the callback condition?
letters="zzZZz";
callback=function(inp){return inp=="z";}
allZs = letters.every(callback);
writeOutput(allZs)
Expected Result: YES
Signup for cfbreak
to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.