简体   繁体   English

斜杠(“/”)字符前后的反向字符串

[英]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: 正确的文字是:

在此输入图像描述

But when it is displayed as: 但是当它显示为:

在此输入图像描述

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

How to solve this problem? 如何解决这个问题呢? I have tried css direction and text-align but they didn't work. 我尝试过css directiontext-align但是它们没有用。

Can you change your HTML? 你能改变你的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. 我能使其工作的唯一方法是将波斯比特放在一个范围内并使用unicode-bidi: embed on it。

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

Hope this helps! 希望这可以帮助!

Please try CSS property direction for your textfield 请为您的文本域尝试CSS属性方向

direction: rtl; 方向:rtl;

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

@Amir Amiri i tried the unicode-bidi: bidi-override; @Amir Amiri我尝试了unicode-bidi:bidi-override; inspired by @Mr Lister's answer. 灵感来自@Mr Lister的回答。 please run this code snippet to see if this solves your issue 请运行此代码段,看看这是否解决了您的问题

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM