@technobuddha/library
Version: 
A large library of useful functions
22 lines (21 loc) • 876 B
TypeScript
/**
 * Options for configuring the longest common substring calculation.
 * @group String
 * @category Fuzzy Match
 */
export type LongestCommonSubstringOptions = {
    /** compare the two strings in case insensitive mode */
    caseInsensitive?: boolean;
};
/**
 * Implementation of [Longest Common Substring](https://en.wikipedia.org/wiki/Longest_common_substring_problem) algorithm.
 *
 * Returns the longest possible substring that is substring of both of given strings.
 * @param string1 - First string.
 * @param string2 - Second string.
 * @returns A string that is common to both strings such that there is no
 * common substring with size greater than the length of the string.
 * @group String
 * @category Fuzzy Match
 */
export declare function longestCommonSubstring(string1: string, string2: string, { caseInsensitive }?: LongestCommonSubstringOptions): string;