MCPcopy Create free account
hub / github.com/ipython/ipython / long_substr

Function long_substr

IPython/utils/text.py:412–425  ·  view source on GitHub ↗

Return the longest common substring in a list of strings. Credit: http://stackoverflow.com/questions/2892931/longest-common-substring-from-more-than-two-strings-python

(data)

Source from the content-addressed store, hash-verified

410
411
412def long_substr(data):
413 """Return the longest common substring in a list of strings.
414
415 Credit: http://stackoverflow.com/questions/2892931/longest-common-substring-from-more-than-two-strings-python
416 """
417 substr = ''
418 if len(data) > 1 and len(data[0]) > 0:
419 for i in range(len(data[0])):
420 for j in range(len(data[0])-i+1):
421 if j > len(substr) and all(data[0][i:i+j] in x for x in data):
422 substr = data[0][i:i+j]
423 elif len(data) == 1:
424 substr = data[0]
425 return substr
426
427
428def strip_email_quotes(text):

Callers 1

strip_email_quotesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected