# NeoSoft C-lanague Command Extensions

- comma_split line

  Line is a line as exported from a database or a spreadsheet where fields are delimited as commas, but may also be enclosed by double quotes ("). Quoted fields may contain commas that should not be considered field delimiters. A proper Tcl list of the fields is returned.

  There is no way to embed a double quote within a field.

- comma_join list

  This the reverse of comma_split. Returns the list joined into a single string, with all fields enclosed by double quotes and separated by commas.

- lassign_array list arrayname elementname ?elementname...?

  Assigns successive elements of list to members of the array arrayname indexed by the given elementnames.

  If there are more elementnames than elements in list the associated array members are set to be empty strings. The return values of lassign_array is the value of any unassigned elements of list (when fewer than [llength list] elementnames are supplied).

- lassign_fields list fieldpositionarray arrayname fieldname ?fieldname...?

  - list is a list from which data is to be extracted
  - fieldpositionarray is an array whose members are indexed by fieldnames, and whose values are indexes into list.
  - arrayname is the name of an array into which the values from list will be placed, indexed by fieldpositionarray(fieldname). If arrayname is empty, variables directly named by fieldnames are set instead.
  - fieldname ?fieldname? ... are the names of fields.

  This command is like lassign_array on steroids. Each successive fieldname is used to index into fieldpositionarray to obtain in index into list. The given element of list is extracted and assigned into the variable arrayname(fieldname), or just fieldname if arrayname is empty.

- incr0 variable ?increment?

  Variable is incremented by increment, or 1 by default. If variable is undefined, it is taken to be zero, ie. the result will be increment. The the new value of variable is returned as the result.