// oukichikou 原创
//真正完整无误的pb11.5 数字(可小数)转人民币中文函数
// string as g_uf_chinese(double alb)
string i_number[],i_z,i_salb,i_a,i_b
int i_len,i
string i_rmb
int i_bz = 0 ,i_bz1 = 0//零检测
i_salb=string(alb,"0.00")
i_len=len(i_salb)
i_a = '零壹贰叁肆伍陆柒捌玖'
if dec(mid(i_salb,i_len,1) ) =0 and dec(mid(i_salb,i_len - 1,1)) = 0 then
i_z= "整"
i_number[1] = ""
i_number[2] = ""
else
i_z =""
i_number[1]= mid(i_salb,i_len,1) //分
i_number[2] = mid(i_salb,i_len - 1,1)//角
if integer(i_number[1]) > 0 then
i_number[1] = mid(i_a,integer( i_number[1])+1,1)+mid(i_b,2,1)
else
i_number[1] = ""
end if
if integer(i_number[2]) > 0 then
i_number[2] = mid(i_a,integer( i_number[2])+1,1)+mid(i_b,3,1)
else
i_number[2] = mid(i_b,1,1)
end if
end if
for i=3 to i_len - 1
i_number[i] = mid(i_salb,i_len - i,1)
if integer(i_number[i]) = 0 then
if i = 3 then
i_number[i] ="元"
i_bz1 =1
else
i_number[i] ="零"
i_bz=i_bz + 1
end if
else
i_bz = 0
i_bz1 = 0
i_number[i] = mid(i_a,integer( i_number[i])+1,1)+mid(i_b,i+1,1)
end if
if i= 7 and i_number[i] = "零" then //解决10万问题
i_number[i] = "万"
i_bz1=0
i_bz=1
end if
if i= 11 and i_number[i] = "零" then //解决10亿问题
i_number[i] = "亿"
i_bz1=0
i_bz=1
end if
//零处理: 元后没零,没有多零
if ( i_bz1 = 1 and i_bz > 0) or i_bz > 1 then
i_number[i] = ""
end if
if i_number[i] <> "" then
if i = 11 then // 解决亿万问题
if i_number[10] = "" and i_number[9] = "" and i_number[8] = "" and i_number[7] = "万" then
i_rmb = right(i_rmb ,len(i_rmb) - 1)
end if
end if
i_rmb= i_number[i] + i_rmb
end if
next
return i_rmb
//真正完整无误的pb11.5 数字(可小数)转人民币中文函数
// string as g_uf_chinese(double alb)
string i_number[],i_z,i_salb,i_a,i_b
int i_len,i
string i_rmb
int i_bz = 0 ,i_bz1 = 0//零检测
i_salb=string(alb,"0.00")
i_len=len(i_salb)
i_a = '零壹贰叁肆伍陆柒捌玖'
i_b = '零分角元拾佰千万拾百千亿拾百千'
if dec(mid(i_salb,i_len,1) ) =0 and dec(mid(i_salb,i_len - 1,1)) = 0 then
i_z= "整"
i_number[1] = ""
i_number[2] = ""
else
i_z =""
i_number[1]= mid(i_salb,i_len,1) //分
i_number[2] = mid(i_salb,i_len - 1,1)//角
if integer(i_number[1]) > 0 then
i_number[1] = mid(i_a,integer( i_number[1])+1,1)+mid(i_b,2,1)
else
i_number[1] = ""
end if
if integer(i_number[2]) > 0 then
i_number[2] = mid(i_a,integer( i_number[2])+1,1)+mid(i_b,3,1)
else
i_number[2] = mid(i_b,1,1)
end if
end if
i_rmb = i_z +i_number[2]+i_number[1]
for i=3 to i_len - 1
i_number[i] = mid(i_salb,i_len - i,1)
if integer(i_number[i]) = 0 then
if i = 3 then
i_number[i] ="元"
i_bz1 =1
else
i_number[i] ="零"
i_bz=i_bz + 1
end if
else
i_bz = 0
i_bz1 = 0
i_number[i] = mid(i_a,integer( i_number[i])+1,1)+mid(i_b,i+1,1)
end if
if i= 7 and i_number[i] = "零" then //解决10万问题
i_number[i] = "万"
i_bz1=0
i_bz=1
end if
if i= 11 and i_number[i] = "零" then //解决10亿问题
i_number[i] = "亿"
i_bz1=0
i_bz=1
end if
//零处理: 元后没零,没有多零
if ( i_bz1 = 1 and i_bz > 0) or i_bz > 1 then
i_number[i] = ""
end if
if i_number[i] <> "" then
if i = 11 then // 解决亿万问题
if i_number[10] = "" and i_number[9] = "" and i_number[8] = "" and i_number[7] = "万" then
i_rmb = right(i_rmb ,len(i_rmb) - 1)
end if
end if
i_rmb= i_number[i] + i_rmb
end if
next
return i_rmb