appendSlash property
String
get
appendSlash
包含前后斜线(输入示例:/path0/path1) eg. /path0/path1/
Implementation
String get appendSlash {
if (this.isEmptyString) {
return "";
}
String path = this!.replaceAll("\\r|\\n|\\t", this!);
bool start = false, end = false;
if (!path.startsWith("/")) {
start = true;
}
if (!path.endsWith("/")) {
end = true;
}
if (start || end) {
path = "${start ? "/" : ""}$path${end ? "/" : ""}";
}
return path;
}