search9e / 最长公共子串
最长公共子串生成器
1.0.0
2022-09-14 22:10 UTC
Requires
- php: >=8.0
Requires (Dev)
This package is auto-updated.
Last update: 2024-08-29 18:13:56 UTC
README
search9e\LongestCommonSubstring 接收一个字符串列表,并返回一个包含在所有给定输入中的单个字符串。该实现适用于最短输入字符串最长不超过10-20字节且不保证存在公共子串的集合。对于大输入,您需要使用不同的实现。
用法
$lcs = new s9e\LongestCommonSubstring\LongestCommonSubstring; var_dump($lcs->get(['abcdxyz', 'xyzabcd']));
string(4) "abcd"
$lcs = new s9e\LongestCommonSubstring\LongestCommonSubstring; var_dump($lcs->get(['foo', 'bar']));
string(0) ""