In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-12 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly explains the "java acquisition of Chinese pinyin acronym tool class definition and example usage", the content of the article is simple and clear, easy to learn and understand, the following please follow the editor's train of thought slowly in depth, together to study and learn "java acquisition Chinese pinyin acronym tool class definition and example usage" bar!
This paper gives an example of the definition and usage of the tool class for obtaining the initials of Chinese pinyin by java. Share with you for your reference, the details are as follows:
Package com.sw.documentary.common.utils The public class GB2Alpha {/ / letter Z uses two labels There are 27 values / / I, u, v without initials, followed by the letters private char [] chartable = {'ah','ba', 'wipe', 'pick', 'moth', 'fat','ga','ha','ha', 'strike','Ka','ha', 'mom', 'take','Oh', 'pop', 'period' 'ran','sa', 'collapse', 'dig', 'past', 'pressure', 'turn', 'seat'} Private char [] alphatable = {'A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V' 'Walt, 'XIX,' Yee,'Z'} Private int [] table = new int [27]; / / initialize {for (int I = 0; I)
< 27; ++i) { table[i] = gbValue(chartable[i]); } } public GB2Alpha() { } //主函数,输入字符,得到他的声母, //英文字母返回对应的大写字母 //其他非简体汉字返回 '0' public char Char2Alpha(char ch) { if (ch >='a'& & ch ='A'& & ch = 26) return '0characters; else return alphatable [I];} / / returns the string public String String2Alpha (String SourceStr) {String Result = ""; int StrLength = SourceStr.length (); int i; try {for (I = 0; I < StrLength) based on a string containing Chinese characters. Result +) {Result + = Char2Alpha (SourceStr.charAt (I));}} catch (Exception e) {Result = ";} return Result;} private boolean match (int I, int gb) {if (gb < table [I]) return false; int j = I + 1; / / the letter Z uses two tags while (j < 26 & (table [j])) + + j If (j = = 26) return gb
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.