splitLength method
Divides Uri by separator
and returns the number of elements.
Uriをseparator
で分割し、その要素数を返します。
final path = Uri.parse("aaaa/bbbb/cccc/dddd");
final length = path.splitLength(); // 4
Implementation
int splitLength({String separator = "/"}) {
if (isEmpty) {
return 0;
}
final path = toString();
final paths = path.split(separator);
final length = paths.length;
return length;
}