我試圖26189-abstract-color-background.jpg從這個字串中獲取
void main() {
//? link string
String s = "http://www.exampleSite.com/files/146/26189-abstract-color-background.jpg?666ff";
// s = s.substring(s.lastIndexOf("/") 1);
String s1 = s.substring(s.indexOf('') - 2);
print(s1);
}
uj5u.com熱心網友回復:
使用Uri.parse()和pathSegments
void main() {
String s = "http://www.exampleSite.com/files/146/26189-abstract-color-background.jpg?666ff";
var uri = Uri.parse(s);
print(uri.pathSegments.last);
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/net/331387.html
標籤:javascript 细绳 镖 分裂
