ChineseChar类

Microsoft Pin-Yin Converter

Simplified Chinese Pin-Yin Conversion Library ChineseChar类
命名空间 > Microsoft.International.Converters.PinYinConverter > ChineseChar
封装了简体中文的读音和笔画等基本信息。
语法
C# Visual Basic Managed C++
public class ChineseChar
Public Class ChineseChar
public ref class ChineseChar
成员
所有成员 构造函数 方法 属性 字段 事件



图标 成员 描述
ChineseCharNew(Char)
ChineseChar类的构造函数。

ChineseCharacter
获取这个汉字字符。

CompareStrokeNumber(Char)
将给出的字符和实例字符的笔画数进行比较。

静态成员 GetCharCount(Int16)
检索具有指定笔画数的字符个数。

静态成员 GetChars(String)
获取给定拼音的所有同音字。

静态成员 GetChars(Int16)
检索具有指定笔画数的所有字符串。

静态成员 GetHomophoneCount(String)
检索具有指定拼音的字符数。

静态成员 GetStrokeNumber(Char)
检索指定字符的笔画数。

HasSound(String)
识别字符是否有指定的读音。

IsHomophone(Char)
识别给出的字符是否是实例字符的同音字。

静态成员 IsHomophone(Char, Char)
识别给出的两个字符是否是同音字。

IsPolyphone
获取这个字符是否是多音字。

静态成员 IsValidChar(Char)
识别给出的字符串是否是一个有效的汉字字符。

静态成员 IsValidPinyin(String)
识别给出的拼音是否是一个有效的拼音字符串。

静态成员 IsValidStrokeNumber(Int16)
识别给出的笔画数是否是一个有效的笔画数。

PinyinCount
获取这个字符的拼音个数。

Pinyins
获取这个字符的拼音。

StrokeNumber
获取这个字符的笔画数。

实例
以下代码演示了返回给出字符的笔划数。
拷贝C#
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.International.Converters.PinYinConverter;

namespace Example_CS
{
    class Program
    {
        static void Main(string[] args)
        {
            ChineseChar chineseChar = new ChineseChar('微');
            Console.WriteLine("Stroke number of 微 in Chinese is {0}.", chineseChar.StrokeNumber);
            Console.WriteLine("{0} characters' pinyin is \"wei1\".", ChineseChar.GetHomophoneCount("wei1"));
            if(ChineseChar.IsHomophone('微', '薇'))
            {
                Console.WriteLine("微 and 薇 have the same pinyin.");
            }
            else
            {
                Console.WriteLine("微 and 薇 have different pinyins.");
            }
        }
    }
}

// This code produces the following output:
// 
// Stroke number of 微 in Chinese is 13.
// 37 characters' pinyin is "wei1".
// 微 and 薇 have the same pinyin.
拷贝VB.NET
Imports Microsoft.International.Converters.PinYinConverter

Module Main
    Sub Main()

        Dim chineseChar = New ChineseChar("微")
        Console.WriteLine("stroke number of 微 in Chinese is {0}.", chineseChar.StrokeNumber)
        Console.WriteLine("{0} characters' pinyin is \'wei1\'.", chineseChar.GetHomophoneCount("wei1"))
        If (chineseChar.IsHomophone("微", "薇")) Then
            Console.WriteLine("微 and 薇 have the same pinyin.")
        End If

    End Sub

End Module

' This code produces the following output.

' stroke number of 微 in Chinese is 13.
' 37 characters' pinyin is 'wei1'.
' 微 and 薇 have the same pinyin.
'
拷贝C++
#include "stdafx.h"

using namespace System;
using namespace Microsoft::International::Converters::PinYinConverter;

int main(array<System::String ^> ^args)
{
    ChineseChar ^chineseChar1 = gcnew ChineseChar(L'微');    
    Console::WriteLine("stroke number of 微 in Chinese is {0}.", chineseChar1->StrokeNumber);
    Console::WriteLine("{0} characters' pinyin is \"wei1\".", ChineseChar::GetHomophoneCount("wei1"));
    if(ChineseChar::IsHomophone(L'微', L'薇'))
    {
        Console::WriteLine("微 and 薇 have the same pinyin.");
    }
    else
    {
        Console::WriteLine("微 and 薇 have different pinyins.");
    }

    return 0;
}

// This code produces the following output:
// 
// Stroke number of 微 in Chinese is 13.
// 37 characters' pinyin is "wei1".
// 微 and 薇 have the same pinyin.
继承层次
Object
ChineseChar

程序集: ChnCharInfo (模块: ChnCharInfo) 版本: 1.0.0.0