C 數字 轉換 大寫漢字

2022-07-19 00:57:12 字數 2050 閱讀 7690

呼叫方法

double

m;

try

catch

(formatexception ex)

public

class

money

;public money(double

m)

//////

判斷輸入的數字是否大於double型別

/// private

bool

isnumber

}//////

數字轉換成大寫漢字主函式

/// ///

返回轉換後的大寫漢字

public

string

convert()

else

}else

return

bb; }

//////

小數字轉換只支援兩位的小數

/// ///

轉換的小數

///小數轉換成漢字

private

string floatstring(string

num)

else

else

}else

cc = bb + "分"

; }

return

cc; }

//////

判斷數字位數以進行拆分轉換

/// ///

要進行拆分的數字

///轉換成的漢字

private

string numberstring(string

num)

else

if (num.length > 4 && num.length <= 8

)

else

if (num.length > 8 && num.length <= 12

)

return

bb; }

//////

四位數字的轉換

/// ///

準備轉換的四位數字

///轉換以後的漢字

private

string convert4(string

num)

else

if (num.length == 2

)

else

if (num.length == 3

)

else

else

}else

}else

}return

bb; }

//////

將數字轉換成漢字

/// ///

需要轉換的數字

///轉換後的漢字

private

string convertstring(string

num)

return

bb; }

//////

兩位數字的轉換

/// ///

兩位數字

///轉換後的漢字

private

string convert2(string

num)

else

}else

cc =num;

return

cc; }

//////

三位數字的轉換

/// ///

三位數字

///轉換後的漢字

private

string convert3(string

num)

else

}else

return

bb; }

}

C 數字轉換成大寫漢字程式

using system using system.collections.generic using system.text private double j private string numchinesecharacter new string public money double m 判...

C 數字轉漢字大寫金額

private static string nums 零壹貳叄肆伍陸柒捌玖 private static string units 仟佰拾萬仟佰拾億仟佰拾萬仟佰拾元角分釐 string valuestr value.tostring 0000000000000000.000 valuestr val...

C 數字金額轉成大寫漢字

轉換數字金額主函式 包括小數 數字字串 轉換成中文大寫後的字串或者出錯資訊提示字串 public string convertsum string str 判斷是否是正數字字串 判斷字串 如果是數字,返回true,否則返回false public bool ispositvedecimal stri...