StringEvery

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>

 Adobe

Get help faster and easier

New user?

Adobe MAX 2024

Adobe MAX
The Creativity Conference

Oct 14–16 Miami Beach and online

Adobe MAX

The Creativity Conference

Oct 14–16 Miami Beach and online

Adobe MAX 2024

Adobe MAX
The Creativity Conference

Oct 14–16 Miami Beach and online

Adobe MAX

The Creativity Conference

Oct 14–16 Miami Beach and online