如何将阿拉伯语表达式(日期)转换为英语 [英] How to convert an Arabic Expression(date) to english

查看:169
本文介绍了如何将阿拉伯语表达式(日期)转换为英语的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将阿拉伯日期手动转换为英语日期,

公共函数convert()

Hi I am trying to convert an arabic date to english date manually as

public function convert()

Dim i As String
        Dim engnum As String
        Dim trans As New System.Text.StringBuilder
        'engnum = "0123456789"
        engnum = Label1.Text
        For Each c As Char In engnum
            If Char.IsDigit(c) Then
          If c = "-" Then
              i = "-"
              trans.Append(i)
          ElseIf c = ":" Then
              i = ":"
              trans.Append(i)
          ElseIf c = "٠" Then
              i = "0"
              trans.Append(i)
          ElseIf c = "١" Then
              i = "1"
              trans.Append(i)
          ElseIf c = "٢" Then
              i = "2"
              trans.Append(i)
          ElseIf c = "٣" Then
              i = "3"
              trans.Append(i)
          ElseIf c = "٤" Then
              i = "4"
              trans.Append(i)
          ElseIf c = "٥" Then
              i = "5"
              trans.Append(i)
          ElseIf c = "٦" Then
              i = "6"
              trans.Append(i)
          ElseIf c = "٧" Then
              i = "7"
              trans.Append(i)
          ElseIf c = "٨" Then
              i = "8"
              trans.Append(i)
          ElseIf c = "٩" Then
              i = "9"
              trans.Append(i)
          End If



如果结束
下一个
作为字符串的Dim transtr
transtr = trans.ToString
MsgBox(transtr)

最终功能

但问题是转换时未检测到-"或"/"

我知道这不是将阿拉伯日期转换为英语的建议方法.
请帮助
如果有其他任何方式让我知道



End If
Next
Dim transtr As String
transtr = trans.ToString
MsgBox(transtr)

end function

but problem is either "-" or "/" is not being detected while converting

i know this is not the suggestable way to conver an arabic date to english..
please help
if any other way let me know

推荐答案

如果我纠正缩进,问题会更加明显:
The problem is more obvious if I correct the indentation:
If Char.IsDigit(c) Then
   If c = "-" Then
      i = "-"
      trans.Append(i)
   ElseIf c = ":" Then
      i = ":"
      trans.Append(i)
   ElseIf c = "٠" Then
      i = "0"
      trans.Append(i)


由于只有字符"0"到"9"通过Char.IsDigit测试,因此永远不会执行is-it-a-连字符测试...


Since only the characters ''0'' to ''9'' pass the Char.IsDigit test, the is-it-a-hyphen test never gets executed...


这篇关于如何将阿拉伯语表达式(日期)转换为英语的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆