Since your string is currently standing, the word لطيفة is preserved until the word اليوم; the fact that اليوم is displayed "first" (that is, to the left) is just the (correct) result of the bidirectional Unicode algorithm when displaying text.
That is: the line you start with ("Test: لطيفة; اليوم; a; b") is the result of the user entering "Test:", then لطيفة, then ";", then "اليوم", and then "; and B. " So the C # splitting method actually reflects the way the string is created. Exactly the way it is created is not displayed in the string display, because two consecutive Arabic words are treated as a unit when they are displayed.
If you want the string to display Arabic words in left-to-right order with a semicolon between them, and also keeping the words in the same order, then you must place the Left-Right sign (U + 200E) after the semicolon. This effectively separates each Arabic word as its own unit, and a bi-directional algorithm will process each word separately.
For example, the following code starts with a line identical to the one you are using (with one label added from left to right), but it will separate it according to how you expect it (ie spl [0] = "Test: اليوم "and spl [1] =" لطيفة "):
static void Main(string[] args) { string s = "Test:اليوم;\u200Eلطيفة;a;b"; string[] spl = s.Split(';'); }
source share