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....



CreateParList


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

The function CreateParList generates a string of comma-separated values. The general format of the generated string is a list of numbers/colors 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, double precision values or colors. 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. The parameter ResolveColornames controls whether the color values are indicated by their hexadecimal values or by their names (if possible). The parameter EnclosingBrackets controls whether the list of array elements is enclosed by brackets.

Example: The following are a few examples of the usage of CreateParList. For the 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, 0, 3, true); returns the string "[1.10,2.00,3.23,0.10],"
CreateParList ([1.1,2,3.226,0.10], false, 2, 5, true); returns the string "[1.1000,2.0000,...]"
CreateParList ([6,7,4,0,-1,4,5,7], true, 4, true); returns the string "[6,7,4,0,...],"
CreateParList ([6,7,4,0,-1,4,5,7], false, 3, false); returns the string "6,7,4,..."
CreateParList ([6,7,4,0,-1,4,5,7], false, 0, true); returns the string "[6,7,4,0,-1,4,5,7]"

Hint: Versions [3], [4], [5] and [6] 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, 0, 3, false);

will generate the following string:

   3.23,1.20,3.0e-5



Last Update: 2023-Feb-06