數字轉換成大寫金額

2021-04-01 05:43:22 字數 1679 閱讀 6458

數字轉換成大寫金額

using system;

public class numtocaps

//////將數定轉換大寫金額格式

///引數必須小於萬萬億,且不超過兩位小數多過兩位自動擷取兩位

//////返回大寫金額

///public string getcaps(decimal d)

if(d<0)

if(s.length!=0&&s.length <=19)

cap+=this.getintcap  (s.substring (j,4),i.tostring ());

j+=4;

}cap=this.proczero (cap);

cap+="元";

cap+=getdecimalcap (s.substring (17,2));

if(isneg)

}else

return cap;

}///

/// 處理特殊數字如小數和負小數,零.

///

///

///

private string procspe**um(string num)

if(dec<1&&dec>0)

if(dec<0&&dec>-1)

else

return "";

}///

/// 處理整數部分

///

/// 引數為四個數字為一組的字串

/// 表示該字串是萬億,億,萬等資訊

/// 此字串的大寫

private string getintcap(string intpart,string level)

cap+=temp;

}cap=cap.trimend ('零');

cap+=this.getlevel (level);

}else

return cap;

}///

/// 取得小數部分的大寫表示

///

///

///

private string getdecimalcap(string decimalpart)

else

temp=this.getonenumcap (decimalpart.substring (1,1));

if(temp!="零")

}else

return s;

}///

/// 取得單個數字的大寫

///

///

///

private string getonenumcap(string onenum)

}return capsnum;

}private string getcapunit(string unit)

return s;

}private string getlevel(string level)

return s;

}///

/// 處理多個連續零的情況

///

///

///

private string proczero(string s)

while(s.indexof ("零零")>0);

return s;}}

}

數字轉換成大寫金額

數字轉換成大寫金額 例如 new money 200 tostring 貳佰元 namespace skyiv.util catch system.console.writeline 大寫 newmoney m 該類過載的 tostring 方法返回的是大寫金額字串 class money 建構函式...

小寫金額轉換成大寫

原作在sql 2000中有一些問題。修正錯誤並在sql 2000中執行通過。set nocount on select v lowerstr ltrim rtrim str n lowermoney,20,2 四捨五入為指定的精度並刪除資料左右空格 select i i 1 select v upp...

將金額轉換成大寫漢字

integer li i integer li lendec,li lenint integer li amout flag integer li point string ls amount string string ls single string ls single dx string ls...

小寫金額轉換成大寫 sql server

if exists select from dbo.sysobjects where id object id n dbo l2u andxtype in n fn n if n tf drop function dbo l2u go create function dbo.l2u n lowerm...

小寫金額轉換成大寫 sql server

if exists select from dbo.sysobjects where id object id n dbo l2u andxtype in n fn n if n tf drop function dbo l2u go create function dbo.l2u n lowerm...