[英]Java adding a string before path
我有以下代碼
var aMyPath = this.path.split("/");
aMyPath.pop();
aMyPath.push(this.getField("Drive").value + ".pdf");
aMyPath.join("/")
返回/test/Data12/Surface/Roy/Geology/Development/Inspect/form/PDF/TEST1111.pdf
現在我想在開頭添加另一個 / 以便它看起來//test/Data12/Surface/Roy/Geology/Development/Inspect/form/PDF/TEST1111.pdf
如果我理解正確,你可以寫
String result = "/" + aMyPath.join("/");
甚至
String result = String.format("/%s", aMyPath.join("/"));
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.