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)
| 410 | |
| 411 | |
| 412 | def 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 | |
| 428 | def strip_email_quotes(text): |
no outgoing calls
no test coverage detected