1.获取("C:/Users/test/Desktop/app")
QString appPathAndName= "C:/Users/test/Desktop/app/test.exe";
- 方法一:
qDebug()<<appPathAndName.left(appPathAndName.lastIndexOf("/")); - 方法二:
QString exeName=appPathAndName.section('/', -1); int index = appPathAndName.lastIndexOf(exeName); appPath = appPathAndName.section("",0,index-2,flag); #appPath===="C:/Users/test/Desktop/app" #exeName===="test.exe"
2.去掉file:///
QString appPathAndName= "file:///C:/Users/test/Desktop/app/test.exe";
QString absoluteFilePath = filepath.remove(0,8); //去掉 "file:///"
3.时间日期提取
QString _year = "2015年";
int year = _year.left(_year.length-1);
3579

被折叠的 条评论
为什么被折叠?



