1 /// <Summary> Bytes /// Pinyin search /// </Summary> Bytes /// <Param name = "strtext"> </param> Bytes /// <Returns> </returns> Bytes Private String Getchinesespell ( String Strtext) plaintext {plaintext ){ Int Len = strtext. length; Comment comment; String Mystr = "" ; Commandid; For ( Int I = 0 ; I <Len; I ++) returns {response mystr + = getspell (strtext. substring (I, 1 ); Too many} too many ));} Return Mystr; commandid} commandid ;} /// <Summary> Bytes/// Get the first letter of the Chinese Character /// Bytes /// </Summary> Bytes /// <Param name = "cnchar"> </param> Bytes /// <Returns> </returns> Bytes Private String Getspell ( String Cnchar) bytes {bytes ){ Byte [] Arrcn = encoding. Default. getbytes (cnchar); bytes ); If (Arrcn. length> 1 ) Else {already exist ){ Int Area = ( Short ) Arrcn [ 0 ]; Too many Int Pos = ( Short ) Arrcn [ 1 ]; Too many Int Code = (area < 8 ) + Pos; zookeeper; Int [] Areacode = { 45217 , 45253 , 45761 , 46318 , 46826 , 47010 , 47297 , 47614 , 48119 , 48119 , 49062 , 49324 , 49896 ,50371 , 50614 , 50622 , 50906 , 51387 , 51446 , 52218 , 52698 , 52698 , 52698 , 52980 , 53689 , 54481 }; Too many };For ( Int I = 0 ; I < 26 ; I ++) implements {commandid ){ Int Max = 55290 ; Commandid; If (I! = 25 ) Max = areacode [I + 1 ]; Too many If (Areacode [I] <= Code & Code <max) returns {response timeout ){ Return Encoding. Default. getstring ( New Byte [] {( Byte )( 65 + I)}); then done} finally completed )});}} Return "" ; Commandid} commandid ;} Else Zookeeper Return Cnchar; invalid argument ;}
1 // The following are pinyin suo Yu // Tujuwen modification example Bytes String [] M_list; optional m_list = New String [] { " Electronic brain " , " Finance Department " , " Production Department " , " China " , " Fgdfs in China " , " The skin of the chinam.com " , " Tu juwensheng, male, China " , " Female China " , " Female China " ," Nengu " , " Female " , " Girls' country " }; Too many }; This . Listboxcontrolstavalue. Items. Clear (); optional listboxcontrolstavalue. Visible = True ; Using system. Text. regularexpressions. RegEx Reg = New System. Text. regularexpressions. RegEx ( " [^ A-Za-Z \ r \ n] + " ); 2 If (! Reg. Match (textedit1.text. tostring (). Success) limit ){ 3 String Pattern = textedit1.text. Trim (); trim (); // Traverse all road information in the arraylist Bytes Foreach ( Object O In M_list) operator {Operator ){ // Obtain the abbreviated Chinese characters and Pinyin characters for each road name. Bytes String Strroadname = getchinesespell (O. tostring (). tolower (); then empty (); String Strtxtroadname = Textedit1.text. tolower (); 4 // 1. String Matching at any position 5 Matchcollection matches = RegEx. Matches (strroadname, pattern, regexoptions. ignorecase ); 6 Foreach (Match nextmatch In Matches) 7 { 8 Int Index = Nextmatch. index; 9 String Result = Nextmatch. tostring (); 10 Listboxcontrolstavalue. Items. Add (O ); 11 12 } Else} // 2. Matching Based on pinyin (using the contain and substring functions for determination) only matches the first letter on the top. Bytes If (Strroadname. Contains (strtxtroadname) & strroadname. substring ( 0 , Strtxtroadname. length) = strtxtroadname) returns {commandid listboxcontrolstavalue. items. add (o); export maxitemcount = listboxcontrolstavalue. items. count; commandid} commandid ;}}} Else Detail {detail details {// Show all data when textbox is empty Too many rows} else}