• Tutorials

  • Home
  • Delimited Strings

    Delimited strings allow 'Array-Like' capabilities. A 'Delimited String' is an array of strings.

    A delimited String is a string consisting of a series of strings separated (delimited) by a special character which is not found in any of the strings that are contained within the Delimited String. For example, let us create a Delimited String containing the 'Undead Types' that appear in a combat. We will assume that he 'Undead Type' names do not contain the character '#'. each 'Undead Type' should then be preceeded by '#'. This is how it might look:
    #Skeleton#Wraith#Bones#Airdale

    You can probably see that there is an easy way to create Delimited Strings that contain other Delimited Strings as its emements. (Hint: Use a different delimiter character for the 'sub-delimited strings'.)

    The first character of the Delimited String defines the 'delimiter character'. There are functions that reference the 'Sub-strings' as an array and otherwise manipulate Delimited Strings.


    $DelimitedStringCount(ds)

    Returns the number of 'substrings' of the delimited string ds.
    $DelimitedStringCount(“#abc#def#ghi”) would return “3”.

    $DelimitedStringSubstring(ds, N)

    Returns the Nth substring of a delimited string ds.
    $DelimitedStringSubstring(#abc#def#ghi”, 0) would return “abc”.
    $DelimitedStringSubstring(#abc#def#ghi”, 3) would return “”.

    $DelimitedStringHead(ds)

    Returns the first substring of ds.
    Exactly the same as $DelimitedStringSubstring(0);

    $DelimitedStringTail(ds)

    Returns the Delimited String ds without its first substring.
    $DelimitedStringTail(“#abc#def#ghi”) would return “#def#ghi”.

    $DelimitedStringAdd(ds, head, delim)

    Returns the string ds with 'head' added as the first element.
    The first character of 'delim' will be used as a delimiter if ds is empty.
    $DelimitedStringAdd(“$ABC$DEF”, “xyz”, “*”) would return “$xyz$ABC$DEF”;
    $DelimitedStringAdd(“”, “xyz”, “*”) would return “*xyz”;

    $DelimitedStringFilter(ds, dsF, filter)

    Returns the 'Filtered' ds string, using the 'dsF' string as the 'Filter String' and 'filter' as the logical operation to be performed. Currently implemented filter functions are:
    “AndNot” – Returns a DelimitedString with elements that are contained in ds 'And are Not' contained in 'dsF'.
    $DelimitedStringFilter(“$a$b$c$a”, “$b”, “AndNot”) would return “$a$c$a”.
    $DelimitedStringFilter(“$a$b$c$a”, $a$c”, “AndNot”) would return “$b”.