arraycommonprefix(
arraycommonprefix(
TEXT
,
SEPARATOR
)

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

- filecatalog( -- builds a text array listing the files in a folder, including any subfolders of that folder.
- Text Arrays -- A numbered collection of text values.

History

Version | Status | Notes
10.1 | New | New in this version.