Skip to content

@technobuddha > library > String > Fuzzy Match

Function: longestCommonSubstring() ​

ts
function longestCommonSubstring(
   string1: string, 
   string2: string, 
   __namedParameters: LongestCommonSubstringOptions): string;

Defined in: longest-common-substring.ts:24

Implementation of Longest Common Substring algorithm.

Returns the longest possible substring that is substring of both of given strings.

Parameters ​

ParameterTypeDescription
string1stringFirst string.
string2stringSecond string.
__namedParametersLongestCommonSubstringOptions-

Returns ​

string

A string that is common to both strings such that there is no common substring with size greater than the length of the string.