FastReport FR report user-defined function: case-insensitive conversion of RMB

Source: Internet
Author: User

The control version is:
----------
FastReport 3.23.12 Enterpise for d2006 (DeXter)

The settings are as follows:
----------
Function TJzpzEdit1.MoneyCn (mmje: Double): string;
Const
S1: string = '0, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4 ';
S2: string = 'getting hundreds of millions of users to get hundreds of millions of users from baibai ';

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: = 'negative ';
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 (dx, '0', '0'), '0 ',
'0 '),
'Zero pick', 'zero '), 'zero angular', 'zero '), 'zero point', 'whole ');
Dx: = StrTran (dx, '0', '0'), '0 ',
'0 '),
'000000', '000000'), '000000', '000000'), 'zero meta', 'meta ');
If dx = 'shape' then
Result: = 'zero-yuan unival'
Else
Result: = StrTran (dx, 'billionaire, 'yi0'), 'zero', 'Integral ');
End;
//////////
Procedure TJzpzEdit1.FormCreate (Sender: TObject );
Begin
FrxReport1.AddFunction ('function MoneyCn (mmje: Double): String; ', 'myfunction', 'function that converts lowercase values to uppercase ');
End;
//////////
Function TJzpzEdit1.frxReport1UserFunction (const MethodName: string;
Var Params: Variant): Variant;
Begin
If UpperCase (MethodName) = UpperCase ('moneycn') then
Result: = MoneyCn (Params [0]);
End;
//////////
Call method in report
MoneyCn (50000000)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.