Convert RMB to uppercase

Source: Internet
Author: User

/** <Br/> * convert RMB to uppercase <br/> * @ Param value <br/> * @ return string <br/> */<br /> Public static string hangetobig (double value) <br/>{< br/> char [] hunit = {'snapshot', 'hangzhou', 'hangzhou '}; // indicates the position in the segment. <br/> char [] vunit = {'wan', '6666 '}; // The segment name indicates <br/> char [] digit = {'0', 'yi', 'er', 'san', 'siz', 'wu ', 'land', 'region'}; // numeric representation <br/> long midval = (long) (value * 100 ); // convert to an integer <br/> string valstr = string. valu EOF (midval); // convert to a string </P> <p> string head = valstr. substring (0, valstr. length ()-2); // integer <br/> string rail = valstr. substring (valstr. length ()-2); // obtain the fractional part </P> <p> string prefix = ""; // integer part Conversion Result <br/> string suffix = ""; // result of fractional conversion <br/> // number of digits after the decimal point <br/> If (rail. equals ("00") <br/> {// If the fractional part is 0 <br/> suffix = "integer "; <br/>}< br/> else <br/> {<br/> suffix = digit [rail. charat (0)-'0'] + "" + Digit [rail. charat (1)-'0'] + "points "; // otherwise, convert the angle score <br/>}< br/> // process the number before the decimal point <br/> char [] chdig = head. tochararray (); // convert the integer part into a character array <br/> char zero = '0 '; // The flag '0' indicates the occurrence of 0 <br/> byte zerosernum = 0; // the number of consecutive occurrences of 0 <br/> for (INT I = 0; I <chdig. length; I ++) <br/>{// process each number cyclically <br/> int idx = (chdig. length-I-1) % 4; // get the position in the segment <br/> int vidx = (chdig. length-I-1)/4; // fetch the segment position <br/> If (CH Dig [I] = '0') <br/> {// if the current character is 0 <br/> zerosernum ++; // increase by 0 consecutive times <br/> If (zero = '0') <br/> {// flag <br/> zero = digit [0]; <br/>}< br/> else if (idx = 0 & vidx> 0 & zerosernum <4) <br/>{< br/> prefix + = vunit [vidx-1]; <br/> zero = '0'; <br/>}< br/> continue; <br/>}< br/> zerosernum = 0; // zero for 0 consecutive times <br/> If (zero! = '0') <br/> {// if the flag is not 0, add, for example, million or more. <br/> prefix + = zero; <br/> zero = '0'; <br/>}< br/> prefix + = digit [chdig [I]-'0']; // convert this number to <br/> If (idx> 0) <br/> prefix + = hunit [idx-1]; <br/> If (idx = 0 & vidx> 0) <br/> {<br/> prefix + = vunit [vidx-1]; // The end of the segment should contain a segment name of or <br/>}</P> <p> If (prefix. length ()> 0) <br/> prefix + = 'circle '; // If the integer part exists, the circle is displayed. <br/> return prefix + suffix; // return the correct representation <br/>}

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.