Login
...or Sign up
Home
Search
Search Code Snippets
Search People
Search
Code Snippets
People
1 Code Snippet found matching find function
<!--- Use this to do an exact pattern check for a value in a list. This is useful inside of a loop checking numbers against a number list. EX : list = "91, 92" if you loop from 1 - 100, ListFind and related CF functions will match on 1, 2, and 9. Not just 91 and 92 Use this when you're looping and you ONLY want to match on 91, or 92 ---> <cffunction name="ListHasValue" access="public" returntype="boolean"> <cfargument name="list" required="yes" type="string"> <cfargument name="value" required="yes" type="any"> <cfscript> // clean up to be safe list = trim( toString( list ) ); // check to see if we have a *possible* match position = ListContains( list, value ) ; if( position > 0 ) { // NOTE : KEEP THE TRIM AND TOSTRING found_value = trim( toString( ListGetAt( list, position ) ) ); if( Compare( value, found_value ) == 0 ) { return true; } } // no match for you! return false; </cfscript> </cffunction>
Coldfusion > ListHasValue pattern search function
Uploaded on
8/12/2009 12:33:08 AM
Programming Language:
Coldfusion
By:
ericfickes
See more code snippets of
ericfickes
Coldfusion
find function
find pattern
list search function
ListHasValue
1
Help
Help by email
What is Naslu?
|
About Naslu
|
Contact
|
Terms of Use
|
Downloads
|
Webprogramacion.com
|
Blog
|
Top
Links
Select language:
Español
|
English
© 2009 naslu.com