拆分波斯语字符,包括StandAlone字符 [英] Splitting Farsi Characters including StandAlone characters

查看:90
本文介绍了拆分波斯语字符,包括StandAlone字符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨每一个



有没有一种简单的方法可以将像سلام这样的波斯语字符串分成它的字符。

我想要的独立字符不是例如ل。

Hi every one

Is there a simple way to split a Farsi String like "سلام" into it's characters.
I want to have stand alone characters not for example "ل".

推荐答案

检查MSDN看起来好像你需要使用System.Globalization.StringInfo.ParseCombiningCharacters和StringInfo .TextElementEnumerator

这里有一些示例代码:

TextElementIterator

ParseCombiningCharacters



Noddy示例:



Checking MSDN it looks as though you'll need to use System.Globalization.StringInfo.ParseCombiningCharacters and StringInfo.TextElementEnumerator
There's some example code here:
TextElementIterator
ParseCombiningCharacters

Noddy example:

StringBuilder b = new StringBuilder();
StringInfo si = new StringInfo("αβγδεζηθικλμνξοπρστυφχψωέϊή");
Console.WriteLine(si.LengthInTextElements);

TextElementEnumerator iter = StringInfo.GetTextElementEnumerator("αβγδεζηθικλμνξοπρστυφχψωέϊή");
while (iter.MoveNext()) {
  b.Append(iter.GetTextElement()).Append(" ");
  }

 MessageBox.Show(b.ToString());


这篇关于拆分波斯语字符,包括StandAlone字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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