JAVA, SQL Server does not support English phonetic transcription, for the [] phonetic transcription of the replacement

Source: Internet
Author: User

Importjava.util.ArrayList;ImportJava.util.HashMap;Importjava.util.List;ImportJava.util.Map; Public classZhybtest { Public Static voidMain (string[] args) {Map<String,Object> map=NewHashmap<string, object>(); Map.put ("A0", "?"); Map.put ("A1", "?"); Map.put ("A2", "?"); Map.put ("A3", "Æ"); Map.put ("A4", "?"); Map.put ("A5", "?"); Map.put ("A6", "?"); Map.put ("A7", "?"); Map.put ("A8", "?"); Map.put ("A9", "D"); Map.put ("A10", "?"); Map.put ("A11", "?"); Map.put ("A12", "?"); String Str= "☆bassinet [, Bæs? ') NET] n. Cradle Cradle can also be called Cradle [' kre?d (?) L]. but! Cradle The word also has another meaning, we look at the example sentence: Ah! Yellow river! The cradle of Chinese nation! Yes, it is the birthplace of the meaning ~ "; String txt=STR;//Give the STR string to txt firstList list_false=NewArrayList ();//only the non-rotating phonetic transcription is storedList list_true=NewArrayList ();//only the phonetic transcription that has been transferred         while(Str.indexof ("[") >0&&str.indexof ("]") >0) {String str_a=str.substring (Str.indexof ("[") +1, Str.indexof ("]")); //System.out.println ("Pre-conversion---------->" +str_a);List_false.add (str_a);  for(intI=0;i<map.size (); i++){                //First, find out if the string has special characters in the map.                if(Str_a.indexof (Map.get ("a" +i). ToString ()) >0){                    //Here's the key that transforms the special character into a map                    if(Map.get ("a" +i). ToString (). Equals (Str_a.substring (Str_a.indexof (Map.get ("a" +i). ToString ()), Str_a.indexof ( Map.get ("A" +i). ToString ()) +1))){                        //System.out.println (Map.get ("a" +i) + "switch to--->" + "a" +i);Str_a=str_a.replace (Map.get ("a" +i). ToString (), "a" +i); //System.out.println ("converted results---------->" +str_a);                    }                }            }            //System.out.println ("converted---------->" +str_a);List_true.add (str_a);//Save to list after each conversionStr=str.substring (Str.indexof ("]") +1, Str.length ()); }         for(intI=0;i<list_false.size (); i++) {txt=Txt.replace (List_false.get (i). ToString (), List_true.get (i). ToString ()); } System.out.println ("Print out ———————— >" +txt); }}

Hope to help everyone, we remember to leave a comment ~ o (∩_∩) o

JAVA, SQL Server does not support English phonetic transcription, for the [] phonetic transcription of the replacement

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.