Longest common substring: Difference between revisions
m
→{{header|PowerShell}}
Line 989:
<lang PowerShell>function lcs([String]$is,[String]$js) {
if ([String]::IsNullOrEmpty($is) -or [String]::IsNullOrEmpty($js)) {return ""}
if ($
$ok = ($i
while ($
while ($continue) {▼
if ($is.Chars($i) -eq $js.Chars($j)) {break}
$
}
$p
while ($
if ($is.Chars($i) -ne $js.Chars($j)) {break}
$i +
$j +
}
if ($sizeMax -lt $size) {
$iMax, $sizeMax = $p, $size
|