The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....


Class: None
Declaration: [1] function CreateParList (ParArray: TDoubleArray; FinalComma: boolean; MaxElems, SigDig: integer): string;
[2] function CreateParList (ParArray: TIntArray; FinalComma: boolean; MaxElems: integer): string;
[3] function CreateParList (ParArray: array of integer; FinalComma: boolean): string;
[4] function CreateParList (ParArray: array of double; FinalComma: boolean): string;

The function CreateParList generates a string of comma-separated values. The general format of the generated string is a list of numbers enclosed by brackets, with an optional comma after the closing bracket. In the case the list of numbers is abbreviated, an ellipsis ('...') at the end of the abbreviated list indicates that there are actually more elements in ParArray.

The parameter ParArray is a one-dimensional array of integers or double precision values. The parameter FinalComma determines whether a comma is appended after the closing bracket. The parameter MaxElems controls the maximum number of displayed values. If the number of elements of the array is greater than MaxElems only MaxElems are shown, followed by an ellipsis. Set the parameter MaxElems to zero in order to include all elements of the array. The parameter SigDig determines the number of significant digits used for each element. Version [4] always returns the values using 3 significant digits.

Example: Following are a few examples of the usage of CreateParList. For sake of simplicity the ParArray parameter is given numerically, but of course you could simply pass an array variable instead of the explicit values:
CreateParList ([1.1,2,3.226,0.10], true); returns the string "[1.10,2.00,3.23,0.10],"
CreateParList ([1.1,2,3.226,0.10], false, 2, 5); returns the string "[1.1000,2.0000,...]"
CreateParList ([6,7,4,0,-1,4,5,7], true, 4); returns the string "[6,7,4,0,...],"
CreateParList ([6,7,4,0,-1,4,5,7], false); returns the string "[6,7,4,0,-1,4,5,7]"

Hint: Versions [3] and [4] can be used to pass a list of parameters directly in the calling statement. For example, assuming that the variables a, b and c are of type double and hold the values 3.23, 1.2 and 0.00003, respectively, the statement

   CreateParList ([a,b,c], false);

will generate the following string:


Last Update: 2017-Aug-30