Install TinyPinyin via NuGet
masterYou can install TinyPinyin for the .NET platform using the NuGet Package Manager. Search for TinyPinyin in the NuGet interface or use the Package Manager Console.
Install-Package TinyPinyinrepository·master·Indexed 42 days ago
https://github.com/hstarorg/tinypinyin.netA fast, low-memory footprint .NET library for converting Chinese characters to Pinyin. It provides the PinyinHelper class for converting strings to uppercase Pinyin without tone marks, GetPinyinInitials for extracting first letters, and IsChinese to identify Chinese characters.
You can install TinyPinyin for the .NET platform using the NuGet Package Manager. Search for TinyPinyin in the NuGet interface or use the Package Manager Console.
Install-Package TinyPinyinThe PinyinHelper class provides simple APIs to convert Chinese characters or full strings into Pinyin.
Key behaviors:
// Get Pinyin for a single character
string pinyinChar = PinyinHelper.GetPinyin('汉');
// Get Pinyin for a full string with a custom separator
string pinyinText = PinyinHelper.GetPinyin("你好", "-");Use IsChinese(char c) to determine if a specific character belongs to the Chinese character set.
bool isChinese = IsChinese('A'); // falseUse GetPinyinInitials to extract the first letter of the Pinyin for each character in a string. This is useful for implementing search-by-initials functionality.
str: The input string.separator: An optional separator used to split the input string before processing (defaults to an empty string, meaning no splitting).// Get initials for a string
string initials = GetPinyinInitials("你好");