split_piped_string - ObjectVision/GeoDMS GitHub Wiki

String functions split_piped_string

The split_piped_string function splits strings by the pipe character (|) into separate elements.

syntax

split_piped_string(strings: E->String) -> unit F with:
    - attribute<String> (F): the split parts
    - attribute<E> org_rel (F): relation back to original strings

definition

Splits each input string at pipe (|) characters, creating a new element for each part. The result is a new domain containing all the split parts, with a relation back to the original string.

This is commonly used for:

  • Parsing delimited data files
  • Extracting multiple values from a single field
  • Processing pipe-separated lists

arguments

argument description type
strings Input strings to split E->String

result

Returns a container with:

  • A new unit F (the result domain, one element per split part)
  • The split string values (F->String)
  • org_rel: relation from F back to E (which original string each part came from)

performance

Time complexity: O(n × L) where n is the number of strings and L is the average string length.

Memory usage scales with the total number of split parts produced.

conditions

  • Empty strings produce no output elements
  • Consecutive pipes (||) produce empty string elements
  • Leading/trailing pipes produce empty string elements

example

unit<uint32> Records: nrofrows = 3;
attribute<String> categories (Records) := union_data(Records,
    'red|green|blue',
    'apple|orange',
    'single'
);

container split := split_piped_string(categories);
// split unit has 6 elements: 'red', 'green', 'blue', 'apple', 'orange', 'single'
// split/org_rel = {0, 0, 0, 1, 1, 2}

// Count categories per record
attribute<uint32> category_count (Records) := pcount(split/org_rel);
// category_count = {3, 2, 1}

see also

since version

7.100

⚠️ **GitHub.com Fallback** ⚠️