StringSome()
This function calls a given closure/function with every element in a given string and returns true, if one of the closure calls returns true.
Introduced: 6.0.0.126
StringSome( string=string, closure=function );
Returns: Boolean
| Argument | Description |
|---|---|
|
string
string,
required
|
edit
Input string. Alias: inputString, object |
|
closure
function,
optional
|
edit
The value to find or a closure/function that gets every value of the array as input and returns true if the given value is right. Alias: function, callback, udf |
Usage Notes
editSince Lucee 6, this function iterates over each character in the string.
For list-based iteration with delimiters, use ListSome() instead.
Examples
edit myString="lucee";
callback=(x)=>x >= 'a';
writeDump(StringSome(myString, callback));
callback_1=(x)=>x >= 'z';
writeDump( StringSome(myString,callback_1));
See also
- string.some()
- Search Issue Tracker open_in_new
- Search Lucee Test Cases open_in_new (good for further, detailed examples)