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.
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
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
| argument | description | type |
|---|---|---|
| strings | Input strings to split | E->String |
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)
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.
- Empty strings produce no output elements
- Consecutive pipes (||) produce empty string elements
- Leading/trailing pipes produce empty string elements
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}
- ReadLines - splits by line endings
- split_multi_linestring - splits geometry sequences
- String functions
- asList - inverse operation (combines strings with separator)
7.100