Seeing as it's a file path and you're looking for the file name, the correct approach would be this:
// When you have this:
QString s("C:/Users/Admin/AppData/Local/Temp/AudelloTemp/Recording.mp3");
// Do this:
QFileInfo f(s);
QString s1 = f.fileName();
// now s1 is "Recording.mp3"
Nevertheless, to answer your question as worded, the QString
member function to use would be lastIndexOf()
. You've misread the documentation: it doesn't "search backward for the last occurrence," it "looks for the last occurrence in the string, doing it by searching backwards." So in your case, it would indeed return the /
separating AudelloTemp
from Recording.mp3
.