将波斯语数字更改为英文数字 [英] Change Persian numbers to English numbers
本文介绍了将波斯语数字更改为英文数字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在vb.net中将波斯语数字更改为英文数字?
当我从excel文件中读取任何波斯语数字时,我想更改它们英语数字。
谢谢。
解决方案
我们假设您需要将东方阿拉伯语转换为西方语言。
例如,在此表中:
http:// persian.nmelrc.org/persianword/numbers.htm [ ^ ]。
您可以看到代码点在Western和Eastern中没有间隙的顺序相同。这只不过是1728的转变。
所以,转换它的方法之一:
static readonly int easternToWesternShift =
( int )' 0' - ( int )' 0'; // 两个零
static char EasternToWestern( char east){
return ( char )(east-easternToWesternShift);
}
之类......等等...
-SA
Hi,
How can change Persian numbers to English numbers in vb.net?
When I read any Persian numbers from an excel file, I want to change them to English numbers.
Thanks.
解决方案
Let's assume you need to convert Eastern Arabic to Western.
Look for example, at this table:
http://persian.nmelrc.org/persianword/numbers.htm[^].
You can see that the code points go in the same order without the gaps, in both "Western" and "Eastern". This is nothing but a shift of 1728.
So, one of the ways to convert it:
static readonly int easternToWesternShift = (int)'٠' - (int)'0'; // two zeros static char EasternToWestern(char eastern) { return (char)(eastern - easternToWesternShift); }
And the like… And so on…
—SA
这篇关于将波斯语数字更改为英文数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文