Declaration
function IEStrToIntArray(const ArrStr: string; Sort: Boolean = False; AMaxValue: Integer = MAXINT): TIEArrayOfInteger;
Description
Converts a string of comma-separated values, e.g. "1, 3, 5-7" to a zero-based array of integers, e.g. [0,3,5,6,7].
The result can be converted back to a string using
IEIntArrayToStr.
If
Sort is enabled the result will be sorted and duplicates will be removed.
You can optionally set
AMaxValue to contain results to a range.
Note:
◼Input .
◼Input values are expected to be one-based, result values will be be zero-based, i.e. "1" will be returned as 0, etc.
◼Invalid values are ignored without error
// The following have the same effect...
ImageEnMView1.MultiSelectedImagesList := [ 2, 4, 6, 7, 8 ];
ImageEnMView1.MultiSelectedImagesList := IEStrToIntArray( '3, 5, 7-9' );
// Get selection as a string
edtSelectedImages.Text := IEIntArrayToStr( ImageEnMView1.MultiSelectedImagesList ); // e.g. [ 2, 4, 6, 7, 8 ] would return '3, 5, 7-9'
See Also
◼IEIntArrayToStr
◼LayersSelectedList
◼MultiSelectedImagesList