
Function: Explode
The explode
function is used to create an array from a delimited string. It splits the input string into individual elements separated by a specified delimiter. This function is particularly useful when dealing with output from SQL queries or other scenarios where data is structured as a delimited string.
Parameters:
delimiter
(string): The delimiter that separates the elements within the source string.source string
(string): The delimited string that you want to split into an array.
Return value:
Type array string: An array where each cell contains one part of the original string.
Example:
string source = "Element1,Element2,Element3";
array string parts = explode ( ",", source);
int s = sizeof ( parts );
int i;
for (i = 1, s)
print "Part " + i + ": " + parts[i]+"\n";
end for
In this example, the explode
function splits the source
string using a comma (,
) as the delimiter. The resulting array, parts
, contains individual elements from the source string. The for
loop then iterates through the array and prints each part to the console.
The output in the console will be:
Part 1: Element1
Part 2: Element2
Part 3: Element3
See also:
This function is handy for parsing and processing delimited data within your FileMaker solution.