Whatever message this page gives is out now! Go check it out!

StringEvery

Last update:
May 18, 2026

Description

Determines if all elements of a string satisfy a given condition.

Returns

Boolean. True if all elements match a condition; false, otherwise.

Syntax

StringEvery(String string, UDFMethod callback)

Category

History

ColdFusion (2021 release): Added this function.

Parameters

Parameter
Description
string
(Required) The input string in which all elements are to be searched.
callback
(Required) Function that encapsulates criteria.

Example

<cfscript> 
    myString="123456789" 
    // define callback 
    callback=function(chr){ 
        return chr>5 
    } 
    writeOutput(StringEvery(myString,callback)) // YES 
     
    // define another callback 
    callback_1=function(chr){ 
        return chr<1 
    } 
    writeOutput(StringEvery(myString,callback_1)) // NO 
</cfscript>

Example 2

<cfscript> 
    myString="Hello" 
    // define callback 
    callback=x=>x >= 'a' 
    writeOutput(StringEvery(myString,callback)) // YES 
    // define another callback 
    callback_1=x=>x >= 'z' 
    writeOutput(StringEvery(myString,callback_1)) // NO 
</cfscript>

Share this page

Was this page helpful?
We're glad. Tell us how this page helped.
We're sorry. Can you tell us what didn't work for you?
Thank you for your feedback. Your response will help improve this page.

On this page