Add new scanner algorithm, can be enabled with DevNewScanner config option
This commit is contained in:
@@ -52,3 +52,19 @@ func BreakUpStringSlice(mediaFileIds []string, chunkSize int) [][]string {
|
||||
}
|
||||
return chunks
|
||||
}
|
||||
|
||||
func LongestCommonPrefix(list []string) string {
|
||||
if len(list) == 0 {
|
||||
return ""
|
||||
}
|
||||
|
||||
for l := 0; l < len(list[0]); l++ {
|
||||
c := list[0][l]
|
||||
for i := 1; i < len(list); i++ {
|
||||
if l >= len(list[i]) || list[i][l] != c {
|
||||
return list[i][0:l]
|
||||
}
|
||||
}
|
||||
}
|
||||
return list[0]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user