blockly > utils > string > commonWordPrefix

utils.string.commonWordPrefix() function

Given an array of strings, return the length of the common prefix. Words may not be split. Any space after a word is included in the length.

Signature:

export declare function commonWordPrefix(array: string[], opt_shortest?: number): number;

Parameters

Parameter Type Description
array string[] Array of strings.
opt_shortest number (Optional) Length of shortest string.

Returns:

number

Length of common prefix.