Converts lowercase numbers to uppercase, and numbers to English.

Source: Internet
Author: User
Tags strfind
Converts lowercase numbers to uppercase.
 
Method 1: Use the functions provided by the system, but do not meet the financial requirements of mainland China.
 
 
Method 2: Use the following functions.
English:
Static STR num2engstr (real realnum, Boolean shownegative = false)
{
Str aa, BB, T1, T2, T3, B, W, CC, A1;
Int A2, a = 0, c = 0;
Int V, M;
Real tmpreal;
Boolean isnegative = false;
;
 
AA = 'one' + strrep ('', 9-strlen ('one') + 'two' + strrep ('', 9-strlen ('two') +
'Three '+ strrep ('', 9-strlen ('Three') + 'four '+ strrep ('', 9-strlen ('four') +
'Five' + strrep ('', 9-strlen ('five') + 'six' + strrep ('', 9-strlen ('six') +
'Seven' + strrep ('', 9-strlen ('seven') + 'Eight '+ strrep ('', 9-strlen ('Eight') +
'Nine' + strrep ('', 9-strlen ('nine') + 'ten '+ strrep ('', 9-strlen ('ten') +
'Even' + strrep ('', 9-strlen ('even') + 'twelve' + strrep ('', 9-strlen ('twelve') +
'Thirteen' + strrep ('', 9-strlen ('thirteen') + 'Fourteen' + strrep ('', 9-strlen ('Fourteen') +
'Deleteen' + strrep ('', 9-strlen ('deleteen') + 'sixteen' + strrep ('', 9-strlen ('sixteen') +
'Seventeen' + strrep ('', 9-strlen ('seventeen') + 'eighteen' + strrep ('', 9-strlen ('hhteen') +
'Nineten' + strrep ('', 9-strlen ('nineten '));
BB = "twenty thirty forty incluty sixty seventyeighty ninety ";
 
If (realnum = 0)
Return 'zero only .';
If (realnum <0)
{
Realnum = ABS (realnum );
Isnegative = true;
}
Tmpreal = decround (realnum, 2 );
T1 = strltrim (num2str (tmpreal, 20, 2, 1, 0 ));
T2 = '';
T3 = T1;
If (strfind (T3, '.', 1, 20 )! = 0)
{
V = strfind (T3, '.', 1, 20 );
T1 = substr (T3, 1, V-1 );
T2 = substr (T3, V + 1, strlen (T3)-V );
}
 
T1 = strrep ('', 10-strlen (T1) + T1;
Cc = T1;
B = '';
W = '';
M = 9;
While (M> 0)
{
If (substr (CC, m + 1, 1) = '')
Break;
If (str2num (substr (CC, m-1, 3 ))! = 0)
{
If (M = 6)
W = 'thousand' + W;
Else if (M = 3)
W = 'millon' + W;
 
A = str2num (substr (CC, m, 2 ));
If (! = 0)
{
If (A <20)
B = strrtrim (substr (AA, (A-1) * 9 +, 9 ));
Else
{
A1 = strltrim (num2str (A, 20, 0, 1, 0 ));
A2 = str2num (substr (A1, 1, 1 ));
B = strrtrim (substr (BB, (A2-2) * 7 + 1, 7 ));
A2 = str2num (substr (A1, 2, 1 ));
If (A2! = 0)
B = strrtrim (B + '-' + substr (AA, (A2-1) * 9 + 1 9 ));
 
}
W = B + W;
}
 
A = str2num (substr (CC, m-1, 1 ));
If (! = 0)
{
B = strrtrim (substr (AA, (A-1) * 9 + 1, 9) + 'hundred ';
If (W! = ''& M = 9)
B = B + 'and ';
W = B + W;
}
}
M = m-3;
}
If (W = '')
W = 'zero ';
If (T2! = ''& T2! = '00 ')
W = strrtrim (strltrim (w) + ''+ T2 + '/123 ';
If (substr (W, strlen (w)-11,12) = 'hundred and ')
W = substr (W, 1, strlen (w)-5 );
If (isnegative & shownegative)
Return 'negative '+ W + 'only .';
Else
Return W + 'only .';
 
}
 
Simplified Chinese:
Static STR num2chnstr (real realnum)
{
Real y;
Int B,;
Str je, X, Hz1, hz2, E, H, F, M;
Boolean isnegative = false;
 
If (realnum = 0)
Return 'garden 0 ';
If (realnum <0)
{
Realnum = ABS (realnum );
Isnegative = true;
}
 
Y = realnum;
X = strltrim (strrtrim (num2str (Y, 20, 2, 1, 0 )));
B = strlen (x)-3;
A = 1;
E = substr (X, A, 1 );
Hz2 = 'zero errors and complex errors ';
Hz1 = 'Collect hundreds of millions of yuan from each other and collect tens of thousands of yuan from each other ';
Je = '';
While (E! = '.')
{
H = substr (hz2, str2num (e) * 2 + 1, 2 );
F = substr (Hz1, 24-(B-a) * 2-1, 2 );
If (E! = '0' | (E = '0' & (F = '000000' | f = 'wan' | f = 'yuan ')))
Je = strltrim (strrtrim (JE) + H + F;
Else
Je = strltrim (strrtrim (JE) + h;
A = a + 1;
E = substr (X, A, 1 );
}
A = a + 1;
E = substr (X, A, 1 );
H = substr (X, A + 1, 1 );
If (E = '0' & H = '0 ')
Je = je + 'Integral ';
Else
{
If (E = '0 ')
Je = je + '0' + substr (hz2, str2num (h) * 2 + 1, 2) + 'Min ';
Else if (H = '0 ')
Je = je + substr (hz2, str2num (e) * 2 + 1, 2) + 'angularization ';
Else
Je = je + substr (hz2, str2num (e) * 2 +) + 'angular '+ substr (hz2, str2num (h) * 2 +) + 'Min ';
}
B = strlen (JE );
A = 1;
While (A <B)
{
M = substr (JE, A, 4 );
If (M = '0 Garden '| M = '000000' | M = '000000' | M = '0 0 ')
{
Je = substr (JE, 1, A-1) + strltrim (strrtrim (substr (JE, A + )));
A = A-2;
B = B-2;
}
A = a + 2;
}
 
If (substr (JE, 1, 2) = 'yuan' & strlen (JE)> 2)
Je = substr (JE, 3, strlen (JE)-2 );
If (isnegative)
Je = 'negative '+ je;
Return je;
}

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.