AEvalAT Function (Array OfT, FuncT, T, DWord, DWord) | |
Execute a code block for each element in an array and assign the return value to each element in the array.
Namespace:
XSharp.RT
Assembly:
XSharp.RT (in XSharp.RT.dll) Version: 2.21
Syntax FUNCTION AEvalA<T>(
aArray AS ARRAY OF<T>,
cbBlock AS Func<T, T>,
nStart AS DWORD,
nCount AS DWORD
)
AS ARRAY OF<T>
public static Array Of<T> AEvalA<T>(
Array Of<T> aArray,
Func<T, T> cbBlock,
uint nStart,
uint nCount
)
Request Example
View SourceParameters
- aArray
- Type: Array OfT
The array to traverse. - cbBlock
- Type: FuncT, T
The code block to execute. - nStart
- Type: DWord
The starting element.
A negative value starts from the end.
If nCount is positive, the default value is 1; if nCount is negative, the default value is the length of the array.
- nCount
- Type: DWord
The number of elements to process from nStart.
A negative value starts from the end.
The default is all elements to the end of the array.
Type Parameters
- T
- The type of the array elements
Return Value
Type:
Array OfT
A reference to
aArray.
Remarks
AEvalA() is similar to AEval() in that they both evaluate a code block once for each element of an array,
passing the element value as an argument.
The difference is that while AEval() ignores the return value of the code block,
AEvalA() assigns the return value to the array element.
See AEval() for details.
Examples
This example uses AEvalA() to create an array of file names in lowercase:
1FUNCTION Start()
2 LOCAL aFiles := Directory("*.dbf")
3 LOCAL nTotal AS SHORTINT
4 AEvalA(aFiles,{|aDBFFile| LOWER(PadR(aDBFFile[F_NAME], 10))})
See Also