On 2/16/22 11:24 PM, David Faure wrote:
On jeudi 17 février 2022 07:36:10 CET mark_at_yahoo via Rosegarden-devel wrote:#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) if (path2.back() != '/') #else if (path2[path2.size() - 1] != '/') #endifThis can be written as if (!path2.endsWith('/')) in all Qt versions.
That looks optimal to me. Better than either of the other two alternatives above, even without considering the 5.10+ dependency issue.
The documentation for back() and front() at https://doc.qt.io/qt-5/qstring.html point to at() and operator[]() as alternatives but not to endsWith() and startsWith(). That's understandable as the former two are closer in functionality. I'll remind myself that it pays to understand a library/component and its interfaces before hacking on code that uses it.
_______________________________________________ Rosegarden-devel mailing list [email protected] - use the link below to unsubscribe https://lists.sourceforge.net/lists/listinfo/rosegarden-devel
