The Visual Studio International Pack contains a set of class libraries that extend the. NET Framework's support for globalized software development. Using classes provided by this class library,. NET developers can more easily create software applications that support multi-cultural and multilingual languages: (1) (ChnCharInfo.dll) Simplified Chinese pin-yin Conversion library- Support to get Simplified Chinese characters commonly used properties such as pinyin, polyphone, phonetic characters, strokes number. "For example:"
1 Microsoft.International.Converters.PinYinConverter.ChineseChar cc=new Microsoft.International.Converters.PinYinConverter.ChineseChar (' state ');
(2) (ChineseConverter.dll) Traditional Chinese to Simplified Chinese Conversion Library and add-in tool-supports conversion between simplified and traditional Chinese. The component also contains a plugin (add-in) in a Visual Studio integrated development environment that supports conversion between simplified traditional Chinese resource files. "For example:"--simplified conversion to Traditional Chinese
1 String temp_1 = Microsoft.International.Converters.TraditionalChineseToSimplifiedConverter.ChineseConverter.Convert ("People's Republic of China", 2 3 Microsoft.International.Converters.TraditionalChineseToSimplifiedConverter.ChineseConversionDirection.SimplifiedToTraditi onal);
--conversion of traditional characters to simplified
1 String temp_2 = Microsoft.International.Converters.TraditionalChineseToSimplifiedConverter.ChineseConverter.Convert (Temp_1, 2 3 Microsoft.International.Converters.TraditionalChineseToSimplifiedConverter.ChineseConversionDirection.TraditionalToSimpli fied);
(3) (EastAsiaNumericFormatter.dll) East Asia Numeric Formatting Library-supports the formatting of lowercase numeric strings into uppercase numeric strings in Simplified Chinese, Traditional Chinese, Japanese, and Korean. "For example:"--Convert a number to uppercase Simplified Chinese (pick up the Hundred billion San Wu to pick up the land million seven Ba Bai Jiu pick point Wu)
1
--Converts a number to lowercase (1,234,567,890,.45)
1 string temp_6 = string. Format (New Microsoft.International.Formatters.EastAsiaNumericFormatter (), "{0:ln}", 1234567890.45);
--Convert numbers to currencies (pick up the Hundred billion San Wu to pick up the land million seven Ba Bai Jiu pick point Wu)
1 string temp_7 = string. Format (New Microsoft.International.Formatters.EastAsiaNumericFormatter (), "{0:LC}", 1234567890.45);
Instance code:
12345678910111213141516171819202122 |
//简体/繁体切换
string temp_1 = ChineseConverter.Convert(
"中国人"
, ChineseConversionDirection.TraditionalToSimplified);
string
temp_2 = ChineseConverter.Convert(
"中国人"
, ChineseConversionDirection.SimplifiedToTraditional);
Console.WriteLine(
"简体转换:"
+temp_1+
"\n繁体转换:"
+temp_2);
//汉字转换拼音
string
r =
string
.Empty;
Console.Write(
"请输入任意汉字:"
);
string
str = Console.ReadLine();
foreach
(
char
obj
in
str)
{
try
{
ChineseChar chineseChar =
new
ChineseChar(obj);
string t = chineseChar.Pinyins[0].ToString();
r += t.Substring(0, t.Length - 1);
}
catch
{
r += obj.ToString();
}
}
Console.WriteLine(r.ToLower().ToString());
|
Source:
Results:
. Net, C # kanji to pinyin, simplified traditional conversion method