PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
CSVToArray (Function)
In french: CSVVersTableau
Fills a one- or two-dimensional array of the specified type with the character string in CSV format passed in parameter. The array is cleared before it is filled.
Versions 25 and later
WEBDEV - Browser code This function is now available in browser code.
New in version 25
WEBDEV - Browser code This function is now available in browser code.
WEBDEV - Browser code This function is now available in browser code.
Example
// One-dimensional array
sMyValues is string = "AT" + CR + "B" + CR + "C" + CR + "D" + CR + "D"
// Initial array
MyArray is array of 3 strings
MyArray[1] = "Y"
MyArray[2] = "X"
CSVToArray(sMyValues, MyArray)
// The array contains: "A" , "B" , "C" , "D" , "D"
// Two-dimensional array
sMyValues is string = "AT" + TAB + "B" + CR + "C" +TAB + "D" + CR + "E" + TAB + "F"
// Initial array
MyArray is array of 2 by 3 strings
MyArray[1,1] = "Y"
MyArray[1,2] = "Z"
CSVToArray(sMyValues, MyArray)
// The array contains: "A;B" , "C;D" , "E;F"
Syntax
CSVToArray(<String> , <Array name> [, <Column separator>])
<String>: Character string
Contains the different array elements.
For a one-dimensional array, the string will be cut according to the CR characters (Carriage Return).
For a two-dimensional array, the string will be cut according to the CR characters (Carriage Return), then according to the separator of columns. The elements will be added row by row. There will be as many rows as the number of CR characters found. Columns will be added if the maximum number of <Column separator> exceeds the number of columns in the array.
Each column must have a corresponding value for the row.
Caution: this parameter must contain no quotes.
<Array name>: Array variable
Name of the one- or two-dimensional array where the elements found in the string must be added. This array must be allocated in a simple type or in a structure type.
<Column separator>: Optional character string (with quotes)
Separator used to separate the values of different columns. By default, the column separator used corresponds to "list separator" found in the regional settings of Windows.
Linux The separator is the semicolon ";".
Remarks
  • The dimension of the array will be modified if necessary: rows and columns may be added according to the values found in <String>.
  • The structure arrays supported are the one-dimensional arrays only.
  • The arrays containing UNICODE strings or variants are not supported.
  • For the Duration type, the value must be given in thousands of a second. The value 0 is not valid. You must use "0000000000".
Business / UI classification : Neutral code
Component : wd250vm.dll
Minimum version required
  • Version 12
This page is also available for…
Comments
Click [Add] to post a comment