fix #955
This commit is contained in:
@ -656,3 +656,18 @@ class StringUtils:
|
||||
return True
|
||||
except ValueError:
|
||||
return False
|
||||
|
||||
@staticmethod
|
||||
def find_common_prefix(str1: str, str2: str) -> str:
|
||||
if not str1 or not str2:
|
||||
return ''
|
||||
common_prefix = []
|
||||
min_len = min(len(str1), len(str2))
|
||||
|
||||
for i in range(min_len):
|
||||
if str1[i] == str2[i]:
|
||||
common_prefix.append(str1[i])
|
||||
else:
|
||||
break
|
||||
|
||||
return ''.join(common_prefix)
|
||||
|
Reference in New Issue
Block a user