It is inevitable to use a segment of a string of characters in a project, so it is often necessary to intercept the string.
There are two ways to solve this problem:
First: QString splits the string:
QString date=dateEdit.toString("yyyy/MM/dd");
QStringList list = date.split("/");//QString string split function
Second: regex to split the string:
1. Oracle database:
Data='12345|rat|male'
select regexp _substr (Data, '[^|]+', 1,1) into user ID from hdata;
select regexp _substr (Data, '[^|]+', 1,2 ) into user name from hdata;
select regexp_substr (Data, '[^|]+', 1,3) into 性别 from hdata;
2、
String s = "ab\ncd\nef\\ngh";
String[] v = s.split("[\n]|([\\\\]n)");