Compiler for .NET Wiki

Acombine Function

Modified: 2007/05/15 21:58 by SamuelDavid - Categorized as: Wish List
I would like to see the opposite of Alines. That is to combine the array elements and producing a string delimited by a character, for instance : so if if astrings is an array which contains astrings1="'assdd'", astrings2=123, astrings3="m.var", astrings4="myfunc(n,m)", m.String=acombine(astrings,",") will produce a string which contains : "'assdd', 123, <>, <
Edit by OlafD: Keep it simpler, just add string type array elements as they are, so
Alines(laLines,expression)
expression = Acombine(laLines)
is possible. You might skip or transform() other elements, not evaluate them.

ACombine(aArray,nFlags,cDelimiter) nFlags 1 - alltrim array elements 2 - include last delimiter, even if last array element is empty 4 - do not include empty elements in result

Bye, Olaf.

Good idea about the parameters. Inline with ALINES behaviour. By the way the concept to be able to eval expressions is very good, but it should go in other function. AApply(aInfo, oCodeBlock)

LOCAL oCodeBlock, bInfo(1)

DIMENSION aInfo(3) aInfo(1) = 1 aInfo(2) = 2 aInfo(3) = 3

oCodeBlock = { |exVal as double| RETURN exVAl^3 && needed return because hardwired to expect it }

bInfo = AApply(aInfo, oCodeBlock)

? bInfo(1) && 1 ? Binfo(2) && 8 ? bInfo(3) && 27

FUNCTION AApply LPARAMETERS aInfo, oDelegate FOR i = 1 TO ALEN(aInfo) aInfo(m.i) = oDelegate(aInfo(m.i)) ENDFOR RETURN aInfo



Samuel David

ScrewTurn Wiki version 2.0.2. Some of the icons created by FamFamFam.