The arraycommonprefix( function finds the common prefix (if any) of all items in an array.
Parameters
This function has two parameters:text – the array to be examined.
separator – the separator character for this array.
Description
This function returns the longest common prefix (if any) of all items in an array.
arraycommonprefix("San Francisco,San Jose,Santa Paula",",") ☞ San
One handy use for this function is to find the highest non-empty folder in an array returned by the filecatalog( function.
let catalog = filecatalog(somePath)
let nonEmptyFolder = arraycommonprefix(catalog,cr())
See Also
History
Version | Status | Notes |
10.1 | New | New in this version. |