In a string to format (mostly to replace chars with different symbols for rendering test on UI), I have to detect % and then skip all chars util first space from this % char
Following is easiest, and extensible, for your requirement "abcd%1$s efgh %2$d ijkl
in this string I have to skip this %1$s
& %2$d
which are some sort of formatting placeholders."
string[] placeHolders = new string[] {"%1$s", "%2$d"};
string[] splits = "abcd%1$s efgh %2$d ijkl".Split(placeHolders, StringSplitOptions.None);
which will provide splits
as ["abcd", "efgh", "ijkl"]
You can get that pretty easily, just grab the index if the first percent sign and then leverage that index to find the first space from there:
var start = myString.IndexOf("%");
var spaceIndex = myString.IndexOf(" ", start)
of course the value of myString is the string you represented in your question.