Python
Copy codeThe Code is as follows: def fn (num ):
'''
Colloquial digital
'''
Ret =''
Num = int (num)
If num/10000 = 0:
Ret = str (num)
Else:
If num/10 ** 8 = 0:
If num % 10000! = 0:
Ret = str (num/10000) + 'wan' + str (num % 10000)
Else:
Ret = str (num/10000) + 'wan'
Else:
N2 = num % 10 ** 8
If n2 % 10000! = 0 and n2/10000! = 0:
Ret = str (num/10 ** 8) + 'yi' + str (n2/10000) + 'wan' + str (n2% 10000)
Elif n2 % 10000! = 0 and n2/10000 = 0:
Ret = str (num/10 ** 8) + 'yi' + str (n2% 10000)
Elif n2 % 10000 = 0 and n2/10000! = 0:
Ret = str (num/10 ** 8) + 'yi' + str (n2/10000) + 'wan'
Elif n2 % 10000 = 0 and n2/10000 = 0:
Ret = str (num/10 ** 8) + '100 billion'
Return ret
Javascript:
Copy codeThe Code is as follows: function int2string (num ){
Num = Number (num );
If (num/10000 <1 ){
Ret = num;
} Else {
If (num/Math. pow (10, 8) <1 ){
If (num % 10000! = 0 ){
Ret = parseInt (num/10000) + '000000' + num % 10000;
} Else {
Ret = parseInt (num/10000) + 'wan ';
}
} Else {
N2 = num % Math. pow (10, 8 );
If (n2% 10000! = 0 & n2/10000! = 0 ){
Ret = parseInt (num/Math. pow (10000) + 'yi' + parseInt (n2/10000) + 'wan' + (n2% );
} Else if (n2% 10000! = 0 & n2/10000 = 0 ){
Ret = parseInt (num/Math. pow (10000) + '100 '+ parseInt (n2% );
} Else if (n2% 10000 = 0 & n2/10000! = 0 ){
Ret = parseInt (num/Math. pow (10000) + '66' + parseInt (n2/) + 'wan ';
} Else if (n2% 10000 = 0 & n2/10000 = 0 ){
Ret = (num/Math. pow (10, 8) + '100 ';
}
}
}
Return ret
}