keyGetFunc function
KeyGet returns the matched part. For example, "/foo/bar/foo" matches "/foo/*", "bar/foo" will been returned
key1
the first argument.
key2
the second argument.
return the matched part.
Implementation
String keyGetFunc(String key1, String key2) {
var index = key2.indexOf('*');
if (index == -1) {
return '';
}
if (key1.length > index) {
if (key1.substring(0, index) == key2.substring(0, index)) {
return key1.substring(index);
}
}
return '';
}