Skip to content

Instantly share code, notes, and snippets.

@seanbamforth
Last active August 29, 2015 14:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seanbamforth/c016d990233ddb9bbc1a to your computer and use it in GitHub Desktop.
Save seanbamforth/c016d990233ddb9bbc1a to your computer and use it in GitHub Desktop.
Dataflex Filter function
//Filters an array according to a passed parameter.
//e.g.
//move (FilterArray(aStringList,self,get_is_uppercase)) to aStringList
Function FilterArray Global Variant[] aVariant Integer hObj Integer iMsg Returns Variant[]
Variant[] aReturn
Integer iPos
Integer iCopied
Integer iMax
Boolean isOK
Move (SizeOfArray(aVariant)) to iMax
For iPos from 0 to (iMax-1)
Get iMsg of hObj aVariant[iPos] to isOK
If (isOK) Begin
Move aVariant[iPos] to aVariant[iCopied]
Move (iCopied+1) to iCopied
End
Loop
Move (ResizeArray(aVariant,iCopied)) to aVariant
Function_Return aVariant
End_Function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment