Dim Scale() As String = {"仟", "佰", "拾", "兆", "仟", "佰", "拾", "億", "仟", "佰", "拾", "萬", "仟", "佰", "拾", "元", "角", "分"} Dim AmountInWords() As String = {"零", "壹", "貳", "叁", "肆", "伍", "陸", "柒", "捌", "玖"} Dim result As String = "" param = Convert.ToDouble(param).ToString("0.00") * 100 For i = 0 To param.Length - 1 For j = 0 To AmountInWords.Count - 1 If param.Substring(i, 1) = j And Integer.Parse(param.Substring(i, 1)) <> 0 Then result += AmountInWords(j) & "" & Scale(18 - param.Length + i) & "" End If Next Next
result = result & "" & IIf(Right(result, 1) = "分", "", "整") Return result
gbk "\xC8\xFE"
big5 "\xCC\xD4"
unicode "\x53\xC1"
看一下内码
Dim AmountInWords() As String = {"零", "壹", "貳", "叁", "肆", "伍", "陸", "柒", "捌", "玖"}
Dim result As String = ""
param = Convert.ToDouble(param).ToString("0.00") * 100
For i = 0 To param.Length - 1
For j = 0 To AmountInWords.Count - 1
If param.Substring(i, 1) = j And Integer.Parse(param.Substring(i, 1)) <> 0 Then
result += AmountInWords(j) & "" & Scale(18 - param.Length + i) & ""
End If
Next
Next
result = result & "" & IIf(Right(result, 1) = "分", "", "整") Return result