Splitting Strings by slashes
I'm just wondering how i can split a string by both front slashes (/) & backslashes (). So for example, these types of strings;
And also mixed slashes;
Would work & in each case return: "X:", "Blah", "blah"
I believe i will need to use a QRegExp, http://doc.qt.io/archives/qt-4.7/qregexp.html but i'm just not sure what character set i will need to use.
str.split( QRegExp("[/\\\\]") );
The regex needs two backslashes to prevent the backslash character from escaping the ] character, and C++ adds an additional two so that you're passing in \ literals.