Today, I suddenly used the function of extracting the first letter of Chinese characters and pinyin. I went online and found that there were not many useful ones. I decided to write one by myself. The effect was good. I sent it to everyone to study it, share with you! Enter the subject directly:
1. First define the E
",-10331.D. add "zhuai",-10329.D. add "zhuan",-10328.D. add "zhuang",-10322D. add "zhui",-10315.D. add "zhun",-10309.D. add "zhuo",-10307.D. add "zi",-10296.D. add "zong",-10281.D. add "zou",-10274.D. add "zu",-10270.D. add "zuan",-10262D. add "zui",-10260.D. add "zun",-10256.D. add "zuo",-10254.
Function g (num)If num> 0 and num G = chr (num)ElseIf num G = ""ElseA = d. ItemsB = d. keysFor I = d. count-1 to 0 step-1If a (I) NextG = B (I)End ifEnd ifEnd functionFunction c (str)C = ""For I = 1 to
In actual projects, we may need to use Chinese characters to generate pinyin into a database. For example, to generate a pinyin url for news titles, or to splice the category items for easy query, there are many application scenarios. My current project is to generate the first pin
PHP converts Chinese characters to Pinyin and obtains the first letter of a word.
This example describes how PHP converts Chinese characters to Pinyin and obtains the first letter of a word. We will share this with you for your re
: This article mainly introduces how PHP separates consecutive Chinese pinyin characters. For more information about PHP tutorials, see. Problem description:
Example: woshidewenfensi => wo shi de wen fen siWoshidewenfensi may have been separated during input. for example, woshi dewen fensi or woshi de wen fensi should eventually be converted to wo shi de wen fen
Similar examples are emerging on the Internet, but most of them remain unchanged: put all the words with the same pronunciation in one row, which corresponds to a pinyin line; search for the row where the Chinese characters are located during conversion, then read the pinyin corresponding to this line. Not to mention t
Original: php kanji Pinyin [contains 20,902 basic Chinese characters +5059 uncommon words]Yesterday in the conversion pinyin found a bug, there are many words can not be converted, but also can not blame him, after all, People's Coucay 8k, should only be used.Helpless on the Internet to find the next, found an article
Php converts Chinese characters to Pinyin code (12 ). Php converts Chinese characters into pinyin codes. the implementation of this program is to convert Chinese
Converting Chinese characters into Pinyin is one of the operational tasks that programmers often use. It is often seen that ios converts Chinese characters into pinyin, excel Chinese
The method is to use a matrix. the Chinese character is composed of two ascii characters, one high-bit code and one low-bit code. the boundary is 128-26464-128. Each Chinese character can contain a maximum of eight characters, A two-dimensional matrix is formed for query. The drawback is that the problem of polyphonic
Pinyin4j is a popular Java library that supports conversion between Chinese characters and pinyin. Pinyin output format can be customized.Official website: http://pinyin4j.sourceforge.net/Sometimes, it is necessary to program the Chinese
Yesterday in the conversion pinyin found a bug, there are many words can not be converted, but also can not blame him, after all, People's Coucay 8k, should only be used.Helpless on the Internet to find the next, found an article "the most full of php Chinese pinyin function (a total of 25961 characters, including 20,9
In iOS development often touch the need to convert Chinese characters into Pinyin, the following is the way I convert Chinese characters to pinyinCode implementation+ (NSString*) Transform: (NSString*) chinese{//Replace the nsstri
Chinese character conversion Pinyin is a common problem in daily development. For example, if we enter "Wh" in the place name of "Great 12306", "Wuhan", "Wuhu", and "Weihai", and enter "Wuhu", the "Wuhu" will appear ".
Java obtains the Chinese pinyin,Pinyin4jThis library can solve this problem very well.
: Http://sour
;) {$ Str = iconv ('utf-8', 'gb2312', $ str ); }$ Words = $ this-> _ cutWord ($ str );Foreach ($ words as $ word) {If ($ this-> _ isAscii ($ word )){/* Non-Chinese */$ Result [] = $ word;Continue; }$ Code = ord (substr ($ word, 0, 1) * 1000 + ord (substr ($ word, 1, 1 ));/* Get the A--Z of the first letter of pinyin */If ($ I = $ this-> _ search ($ code ))! =-1) {$ Result [] = $ this-> _ pin
Chinese characters to pinyin source code
2011-11-21 0 Comments
collection I want to submit
a
post
Valid only for GB2312 encoding
/* An array of code values at the dividing point of the kanji pronunciation */
static const unsigned short code_pin[] = {
0XB0A1,0XB0A3,0XB0B0,0XB0B9,0XB0BC,0XB0C5,0XB
Sometimes the project needs to follow the pinyin of Chinese characters, such as contact list, mineral classification, etc., some of which need to be phonetic Alphabet from A to Z. if the stored Chinese character field encoding uses the GBK character set, because the GBK code encoding itself uses the phonetic sorting m
The above three functions correspond to the Chinese character code, which is equivalent to the conversion to pinyin. Our example is simple. We only use the example code for converting Chinese characters starting with a to pinyin. The above three functions correspond to the
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.