I have simplified in a big way the problem and here is the sample code:
string outputString = string.Empty;
string joinOutputString = string.Empty;
string pathOutputString = string.Empty;
string[] myStrings = new string[4];
myStrings[0] = "First entry";
myStrings[1] = "اول";
myStrings[2] = "دوم";
myStrings[3] = "Last entry";
StringBuilder sb = new StringBuilder();
for (int i = 0; i < myStrings.Length; i++)
{
joinOutputString = string.Join(@"\", joinOutputString, myStrings[i]);
outputString = string.Format(@"{0}{1}\", outputString, myStrings[i]);
pathOutputString = System.IO.Path.Combine(pathOutputString, myStrings[i]);
sb.Append(string.Format(@"{0}\", myStrings[i]));
}
The final value of all strings and StringBuilder at the end of the loop is:
First entry\اول\دوم\Last entry\
instead of
First entry\دوم\اول\Last entry\
The middle right to left section is flipped as one unit.
Thanks for your time in advance.