3 ms·
I don't know about Arabic but in Urdu the numbers are still written left to right. I found that extremely annoying when I was studying Urdu.
by nelblu 3y ago
I don't know about Arabic but in Urdu the numbers are still written left to right. I found that extremely annoying when I was studying Urdu.
- lolc 3y agoUrdu uses the original digit writing direction. Numbers are written little-endian in Arabic, and when Latin adopted the Arabic digits the direction of the digits was kept which made the numbers big-endian in Latin. The users of Latin scripts are used to big-endian numbers and think this is the natural order. But historically numbers are actually little-endian with the writing direction changed around them in Latin scripts. Now I want a snippet that flips numbers to little-endian and uses direction markers to show them the "right" way visually. This would only be a little confusing :-) Update: My LLM got it right on the first try: function reverseDigitsAndCorrectDirection(inputString) { const regex = /-?\d+(\.\d+)?/g; const reverseString = str => str.split('').reverse().join(''); return inputString.replace(regex, match => '\u202E' + reverseString(match) + '\u202C'); }
- jazzyjackson 3y agowow i've never thought of endianness as handedness, it's less esoteric that way.