longestCommonPrefix function
Implementation
@visibleForTesting
String longestCommonPrefix(String a, String b) {
for (var i = 0; i < a.length && i < b.length; i++) {
if (a[i] != b[i]) {
return a.substring(0, i);
}
}
if (a.length < b.length) {
return a;
} else {
return b;
}
}