
Originally Posted by
Lykurg
We should encourage people to think about problems and to came up with a solution of their own. There is no benefit of simply paste a better code/solution. Furthermore, can you explain me the meaning of subtraction of 2 in this line:
QString strFile1
= strFile2.
mid(7, strFile2.
length() - 2);
QString strFile1 = strFile2.mid(7, strFile2.length() - 2);
To copy to clipboard, switch view to plain text mode
?
Ok I have looked into the code again and i see that this makes no sense. For example we have got:
So , i guess he wants to remove the http:// and the extension ?
If so, that
QString strFile1
= strFile2.
mid(7, strFile2.
length() - 2);
QString strFile1 = strFile2.mid(7, strFile2.length() - 2);
To copy to clipboard, switch view to plain text mode
makes no sense. Maybe this solution would be better: (we have checked already for .png and .gif, so this should be correct)
QString strFile1
= strFile2.
mid(7, strFile2.
lastIndexOf("."));
QString strFile1 = strFile2.mid(7, strFile2.lastIndexOf("."));
To copy to clipboard, switch view to plain text mode
Bookmarks