RosettaCodeData/Task/Longest-common-substring/PureBasic/longest-common-substring.basic
2023-07-01 13:44:08 -04:00

16 lines
300 B
Text

Procedure.s lcs(a$,b$)
If Len(a$)>Len(b$) : Swap a$,b$ : EndIf
l=Len(a$)
For c=1 To l
For i=1 To 1+l-c
If FindString(b$,Mid(a$,i,c))
res$=Mid(a$,i,c)
EndIf
Next
Next
ProcedureReturn res$
EndProcedure
t1$="testing123testing"
t2$="thisisatest"
Debug lcs(t1$,t2$)