Author Topic: Script BASIC - missiing commands  (Read 2371 times)

Offline John

  • Forum Support / SB Dev
  • Posts: 3116
    • ScriptBasic Open Source Project
Script BASIC - missiing commands
« on: May 02, 2014, 03:43:16 pm »
I stumbled on a Script BASIC command in the source that I wasn't aware of. (SPLITAQ) I asked Peter Verhas if he had any info about it he could share.

SPLITAQ string BY string QUOTE string TO array

    Split a string into an array using the second string as delimiter. The delimited fields may optionally be quoted with the third string. If the string to be split has zero length the array becomes undefined. When the delimiter is a zero length string each array element will contain a single character of the string.

    Leading and trailing delimiters are accepted and return an empty element in the array. For example :-

       SPLITAQ ",'A,B',C," BY "," QUOTE "'" TO Result

    will generate

                     Result[0] = ""
                     Result[1] = "A,B"
                     Result[2] = "C"
                     Result[3] = ""

    Note that this kind of handling of trailing and leading empty elements is different from the handling of the same by the command SPLIT and SPLITA which do ignore those empty elements. This command is useful to handle lines exported as CSV from Excel or similar application.

    The QUOTE string is really a string and need not be a single character. If there is an unmatched quote string in the string to be split then the rest of the string until its end is considered quoted.

The above is from updated docs that I haven't seen before.

Script BASIC Commands