multivaluepick

Pick/UniBasic Field function that operates with a delimiter of more than one character?


Has there ever been an implementation of the field function (page 311) in the various flavors of Pick/UniBasic etc. that would operate on a delimiter of more than one character?

The documented implementations I can find stipulate one character as the delimiter argument and if the delimiter is presented with more than one character, the first character of the delimiter string is used instead of the entire string as a delimiter.

I am asking this because there are many instances in the commercial and custom software I maintain where I see attempts to use a multi-character delimiter with the field statement. It seems programmers were using it expecting a different result than is currently happening.


Solution

  • jBASE does allow for this. From the FIELD docs:

    This function returns a multi-character delimited field from within a string. It takes the general form:

    FIELD(string, delimiter, occurrence{, extractCount})

    where:

    string specifies the string, from which the field(s) is to be extracted.
    delimiter specifies the character or characters that delimit the fields within the dynamic array.
    occurrence should evaluate to an integer of value 1 or higher. It specifies the delimiter used as the starting point for the extraction.
    extractCount is an integer that specifies the number of fields to extract. If omitted, assumes one.

    Additionally, an example from the docs:

    in_Value = "AAAA : BBjBASEBB : CCCCC"
    CRT FIELD(in_Value , "jBASE", 1)
    

    Producing output:

    AAAA : BB
    

    Update 2020-08-13 (adding context for OpenQM):

    As an official comment since we maintain both jBASE and OpenQM, I felt it worth calling out that OpenQM does not allow multi-character delimiters for FIELD().