CFLib.org – Common Function Library Project

arrayExcludeNumeric(aObj)

Last updated July 6, 2006

Version: 2 | Requires: ColdFusion MX | Library: DataManipulationLib

 
Rated 0 time(s). Average Rating: 0

Description:
Excludes all the numerical items inside an one dimensional array returning a new "non numeric" array.

Return Values:
Returns an array.

Example:

view plain print about
<cfset aTest = arrayNew(1) />
<cfset aTest[1] = "Marcos" />
<cfset aTest[2] = "Placona" />
<cfset aTest[3] = 22 />
<cfset aTest[4] = "www.cfdevelopers.com.br">

<cfdump var="#arrayExcludeNumeric(aTest)#">

Parameters:

Name Description Required
aObj Array to filter. Yes

Full UDF Source:

view plain print about
<!---
 Excludes numeric items from an array.
 V2 by Raymond Camden
 
 @param aObj      Array to filter. (Required)
 @return Returns an array. 
 @author Marcos Placona (marcos.placona@gmail.com) 
 @version 2, July 6, 2006 
--->

<cffunction name="arrayExcludeNumeric" returntype="array">
    <cfargument name="aObj" type="array" required="Yes">
    <cfset var ii = "">
    
    <!--- Looping through the array --->
    <cfloop to="1" from="#arrayLen(aObj)#" index="ii" step="-1">
        <!--- Checking if it's a number --->
        <cfif isNumeric(aObj[ii])>
            <cfset arrayDeleteAt(arguments.aObj, ii) />
        </cfif>
    </cfloop>
    
    <cfreturn aObj />
</cffunction>
blog comments powered by Disqus

Search CFLib.org


Latest Additions

Tayo Akinmade Tayo Akinmade added
arrayTrim
11 day(s) ago

Will Belden Will Belden added
longTime
17 day(s) ago

James Sleeman James Sleeman added
quickSort
27 day(s) ago

Ben Forta Ben Forta added
GetHostAddress
30 day(s) ago

Top Rated

Darwan Leonardo Sitepu EksporSQLData
Rated 5.0, 16 time(s)

Darwan Leonardo Sitepu backupDatabase
Rated 5.0, 13 time(s)

Barney Boisvert indentXml
Rated 5.0, 10 time(s)

Kevin Pepperman generateSsccAsn
Rated 5.0, 4 time(s)

Created by Raymond Camden / Design by Justin Johnson