Convert RMB to uppercase

Source: Internet
Author: User
/*** Convert RMB into uppercase ** @ Param value * @ return string */public static string hangetobig (double value) {char [] hunit = {'pick ', 'hangzhou', 'hangzhou'}; // The position in the segment indicates char [] vunit = {'wan', 'yi '}; // The segment name indicates char [] digit = {'0', 'yi', 'er', 'san', 'siz', 'wu', 'lu ', 'handler', 'handler', 'handler'}; // number indicates long midval = (long) (value * 100); // converts it to an integer string valstr = string. valueof (midval); // convert it to string head = valstr. substring (0, valstr. length () -2); // take the integer part string rail = valstr. substring (valstr. length ()-2); // returns the string prefix = "" in the decimal part; // returns the string suffix = ""; // result of converting the fractional part // process the number of digits after the decimal point if (rail. equals ("00") {// If the fractional part is 0 suffix = "integer";} else {suffix = digit [rail. charat (0)-'0'] + "" + digit [rail. charat (1)-'0'] + "points"; // otherwise, convert the corner points} // process the number before the decimal point char [] chdig = head. tochararray (); // converts the integer part to the character array char zero = '0'; // flag '0 'Indicates the occurrence of 0 byte zerosernum = 0; // the number of consecutive occurrences of 0 for (INT I = 0; I <chdig. length; I ++) {// cyclically process each number int idx = (chdig. length-I-1) % 4; // get the position in the segment int vidx = (chdig. length-I-1)/4; // take the segment position if (chdig [I] = '0') {// if the current character is 0 zerosernum ++; // If (zero = '0') {// flag zero = digit [0];} else if (idx = 0 & vidx> 0 & zerosernum <4) {prefix + = vunit [vidx-1]; zero = '0';} continue;} zero Sernum = 0; // zero if (zero! = '0') {// if the flag is not 0, add the prefix + = zero; zero = '0 ';} prefix + = digit [chdig [I]-'0']; // convert this number to If (idx> 0) prefix + = hunit [idx-1]; if (idx = 0 & vidx> 0) {prefix + = vunit [vidx-1]; // The end position of the segment should contain a segment name, million} If (prefix. length ()> 0) prefix + = 'circle '; // If the integer part exists, return prefix + suffix; // return the correct representation}

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.