Amir Amiri
Amir Amiri

Reputation: 437

Reverse String before and after Slash ("/") character

I have Persian character in my page. when I display a string contains Persian characters within slash character in the text will not show properly. It should reverse the characters to show properly.

The correct text is:

enter image description here

But when it is displayed as:

enter image description here

361/شماره شد/1397/2 

How to solve this problem? I have tried css direction and text-align but they didn't work.

Upvotes: 6

Views: 525

Answers (3)

Manu Joseph
Manu Joseph

Reputation: 81

@Amir Amiri i tried the unicode-bidi: bidi-override; inspired by @Mr Lister's answer. please run this code snippet to see if this solves your issue

 <div style="unicode-bidi: bidi-override;">361/شماره شد/1397/2</div>

Upvotes: 0

Mr Lister
Mr Lister

Reputation: 46589

Can you change your HTML? The only way I can make it work is by putting the Persian bit in a span and use unicode-bidi: embed on it.

.e {unicode-bidi: embed;}
361/<span class="e">شماره شد</span>/1397/2

Hope this helps!

Upvotes: 2

Manu Joseph
Manu Joseph

Reputation: 81

Please try CSS property direction for your textfield

direction: rtl;

<div style="display:inline-block;direction:rtl">1397/2/شماره شد/361</div>

Upvotes: 0

Related Questions