JS RMB Capital

Source: Internet
Author: User

/***
* * Hongshijin
* * [email protected]
* * 2014-10-15 9:13:00.00000
* * Text/javascript
***/

(Function ($)
{

Number.prototype.toRmbString = function ()
{
var C =
{
N: [38646, 22777, 36144, 21441, 32902, 20237, 38470, 26578, 25420, 29590, 25972, 36000],//"0 One and three Woolu Qi Ba nine whole negative";
U: [20191, 20336, 25342, 20140, 20191, 20336, 25342, 21513, 20191, 20336, 25342, 20806, 20191, 20336, 25342, 20740, 20191, 20336, 25342, 33836, 20191, 20336, 25342, 22278, 35282, 20998, 21400, 27627],//"Thousand Bai pick up the Thousand hundred thousand to pick up the thousands of thousands of thousands of thousands of thousands of thousand to pick up the round corner of the Hundred cents";//"Qian Bai picked up Beijing Pick up the thousand and hundreds of thousands of thousand hundred million thousand to pick up the round corner of the Hundred Cents "
M:this
};
if (C.M < 0)
C.M *=-1;
for (var i = c.n.length-1; I >= 0; i--)
{
C.T = C.n[i];
C[C.T] = String.fromCharCode (C.T);
C.n[i] = c[c.t];
}
for (var i = c.u.length-1; I >= 0; i--)
{
C.T = C.u[i];
C[C.T] = String.fromCharCode (C.T);
C.u[i] = c[c.t];
}
C.T = c.m.tofixed (4). Replace ('. ', '). Replace (/^0+ ([0-9])/img, ' $ ');
if (c.t = = "0")
return c[38646] + c[22278] + c[25972]; "0 rounding";

if (C.t.length > C.u.length)
Throw {message: ' The input value too max. '};

C.U = C.u.splice (C.u.length-c.t.length, c.t.length);
for (var i = c.t.length-1; I >= 0; i--)
c.t = c.t.substring (0, I) + c.n[string.charcodeat (c.t.substring (i, i + 1))-String.charcodeat (' 0 ')] + c.u[i] + c.t.substr ing (i + 1, c.t.length);
C.M = new RegExp (c[38646] + ' +[^ ' + c[22278] + c[33836] + c[20740] + c[20806] + c[21513] + c[20140] + '] ', ' img ');
C.T = C.t.replace (C.M, c[38646]); /0 +[^ million trillion]/img, ' 0 '//t = "Yi Qian 0 bai 0 titbits Beijing San 0 bai Wood Pick-up 0 thousand 0 bai 0 pick 0 trillion San Wu Bai II pick 0 Yi restaurant thousand 0 Bai II pick Zevan 0 hundred 0 pick Tientsin one corner 0 minutes 0 wood mm";
C.M = new RegExp (c[38646] + ' {2,} ', ' img ');
C.T = C.t.replace (C.M, c[38646]); /0 {2,}/img, ' 0 '//t = "One Thousand 000 Beijing San 0 wood pick-up 0000 trillion San Wu Bai II pick 0 Yi restaurant thousand 0 II pick Zevan tientsin one corner 00 ng"
C.M = new RegExp (c[38646] + ' + ([' + c[22278] + c[33836] + c[20740] + c[20806] + c[21513] + c[20140] + ']) ', ' img ');
C.T = C.t.replace (C.M, ' $ $ '); /0 + ([round million trillion])/img, "//t =" 0 Beijing San 0 Wood pick-up 0 trillion San Wu Bai II pick 0 Yi restaurant thousand 0 II pick Zevan tientsin one corner 0 ng "
C.M = new RegExp (' ([' + c[33836] + c[20740] + c[20806] + c[21513] + c[20140] + ']) [' + c[33836] + c[20740] + c[20806] + c[ 21513] + c[20140] + ']+ ', ' img ');
C.T = C.t.replace (C.M, ' $ $ '); /([All-in-one-billion]) [million trillion]+/img, ' $ '//t = "One thousand of Beijing three thousand 0 woods to pick up the three thousand Hundred Yi restaurant thousand 0 II pick the zero Tientsin one corner 0 WU"
C.M = new RegExp (' ^[' + c[33836] + c[20740] + c[20806] + c[21513] + c[20140] + ']+ ', ' img ');
C.T = C.t.replace (C.M, "); /^[million trillion]+/img, "//" one in Beijing three thousand 0 wood pick-up Gilling Wu Bai Yi restaurant thousand 0 II pick up the zero Tientsin one corner 0 ng "
if (c.t.substring (0, 1) = = c[38646])//0
C.T = c.t.substring (1, c.t.length);
if (c.t.substring (c.t.length-1, c.t.length) = = c[38646])//0
c.t = c.t.substring (0, c.t.length-1);
if (c.t.substring (c.t.length-1, c.t.length) = = c[22278])//Round
C.T = c.t + c[25972]; Whole
if (this >= 0)
return c.t;

return c[36000] + c.t; Negative minus
};

NUMBER.PROTOTYPE.TORMB = function ()
{
return this.tormbstring ();
};

NUMBER.PROTOTYPE.RMB = function ()
{
return this.tormbstring ();
};

}) (null);

Converts a number to an accounting-usable renminbi capitalization format.

JS RMB Capital

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.