Java將小寫金額轉換成大寫

2021-08-13 14:21:24 字數 624 閱讀 4357

工作中遇到金額小寫轉大寫的需求。由於現成的工具包沒有找到此功能。最後搜到:

**如下:

public class test 

public static string change(double v)

long l = math.round(v * 100);

if (l == 0)

string strvalue = l + "";

// i用來控制數

int i = 0;

// j用來控制單位

int j = unit.length() - strvalue.length();

string rs = "";

boolean iszero = false;

for (; i < strvalue.length(); i++, j++)

} else

rs = rs + digit.charat(ch - '0') + unit.charat(j);

}}// if (!rs.endswith("分"))

rs = rs.replaceall("億萬", "億");

return rs;

}}

小寫金額轉換成大寫

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

小寫金額轉換成大寫 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...