最精簡的小寫金額轉大寫的函式

2021-04-20 18:51:49 字數 978 閱讀 5660

function changdx2(mmje: double): string;

const s1: string = '零壹貳叄肆伍陸柒捌玖';

s2: string = '分角元拾佰仟萬拾佰仟億拾佰仟萬';

function strtran(const s, s1, s2: string): string;

begin

result := stringreplace(s, s1, s2, [rfreplaceall]);

end;

var s, dx: string;

i, len: integer;

begin

if mmje < 0

then

begin dx := '負';

mmje := -mmje;

end;

s := format('%.0f', [mmje * 100]);

len := length(s);

for i := 1

to len do

dx := dx + copy(s1, (ord(s[i]) - ord('0')) * 2 + 1, 2) + copy(s2, (len - i) * 2 + 1, 2);

dx := strtran(strtran(strtran(strtran(strtran(dx, '零仟', '零'), '零佰', '零'), '零拾', '零'), '零角', '零'), '零分', '整');

dx := strtran(strtran(strtran(strtran(strtran(dx, '零零', '零'), '零零', '零'), '零億', '億'), '零萬', '萬'), '零元', '元');

if dx = '整'

then result := '零元整'

else result := strtran(strtran(dx, '億萬', '億零'), '零整', '整');

end;

金額小寫轉大寫

create procedure dbo trannumbertobigfordecrypt n lowermoney numeric 15,2 v transtype int,ret varchar 200 output with encryption as descript 解密exec sp ...

金額小寫轉大寫

create procedure dbo trannumbertobigfordecrypt n lowermoney numeric 15,2 v transtype int,ret varchar 200 output with encryption as descript 解密exec sp ...

ORACLE 小寫金額轉大寫金額

create or replace function money2chinese money in number return varchar2 is stryuan varchar2 150 stryuanfen varchar2 152 numlenyuan number numlenyuanf...