I do not see that as an improvement. One space extra and the array length becomes three, not two. (unless TStringsplitoptions.Exclide empty is specified.
If the second string needs to be quoted, you can requote with s.QuotedString('"');
Improvement as in: I don't care if there are double quotes in the source-string or not.
My Split-Delimiter is SPACE, not Doublequote, so i don't have to juggle ExcludeEmpty and Trimming any resulting strings.
Yes, "requoting" the remaining String is easy enough.
1) Check with "Pos"-Function if source contains Doublequotes
2) Execute my algorithm
3) Requote the Join-Result if 1) was true
I could even leave out the "Replace"-call to remove doublequotes and requote later.
The Doublequotes would just be a part of the Strings
I just used the StartingIndex-Argument of the Join-Function as in:
Take Member 0 of the Array. That's your Errorcode. Everything else from StartingIndex 1 on is the remaining String.