Home > Back-end >  DELPHI fastreport yuan capital problem
DELPHI fastreport yuan capital problem

Time:09-27

I have brothers provide the Delphi writing good function in FASTREPORT can directly call
I now CONVERT is a function of conversion capitals all are Angle points to the yuan, but now don't want a


Var AStr: WideString;//with a wide character in Chinese
YPos, I: integer;
The begin

Try
AStr:=the Convert (StrToFloat (formatfloat (' 0.00 ', & lt; FrxDBDataset1. "shkje & gt;)" ));
For I:=1 to length (formatfloat (' 0.00 ', & lt; FrxDBDataset1. "shkje & gt;)" Do the begin//get the position of the nonzero
If strtofloat (copy (formatfloat (' 0.00 ', & lt; FrxDBDataset1. "shkje & gt;)" And I, length (formatfloat (' 0.00 ', & lt; FrxDBDataset1. "shkje & gt;)" ) - I + 1))=0 then break;

end;

Case length (formatfloat (' 0.00 ', & lt; FrxDBDataset1. "shkje & gt;)" ) + 1 -i of
0: daxiejine. Memo. The add (AStr);
3: daxiejine. Memo. The add (copy (AStr, 1, (I - 1) * 2) + 'whole');
4, 7: daxiejine. Memo. The add (copy (AStr, 1, (I - 1) * 2) + '$');
8,9,10: daxiejine. Memo. The add (copy (AStr, 1, (I - 1) * 2) + 'ten thousand');
11: daxiejine. Memo. The add (copy (AStr, 1, (I - 1) * 2) + '$');
12,13,14,15: daxiejine. Memo. The add (copy (AStr, 1, (I - 1) * 2) + 'one hundred million');

end;


Except,
ShowMessage (' invalid data! Please try again ');
end;

In FASTREPORT WIDESTRING cannot pass

I demand for capital is behind the decimal display element Angle points, not just now how much is the yuan directly!
Hope brother who directly to my section in FASTreport DELPIHI function calls can thank you!!

CodePudding user response:

Is online together with,,,
 
{
Calendar Unit for Borland Delphi 5 (Other Version is not *)

Translated By Ru Xu Liu ([email protected])

The 2001-1-4
}

{
Announcement from the the original author:

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
To see the source code of brothers:
Hello!
This was my calendar program for a commercial PDA product development, recently transplanted in the PC, so the algorithm
Is written in pure c + + and data part, does not involve the use of MFC, all of the code is short to save the storage space is given priority to particular
.
Am glad that you interested in this code, you can copy and use some of the code, the only one with a little
Wish: when you use and copy to others, don't forget to indicate the code author: -), after the program code also just,
The data but I worked so hard to find it out from the calendar to lose in,
If you have a good idea might as well give me a Mail,

[email protected]
Or
[email protected]
In March 2000,
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
}

The unit crash_rmb;

Interface

USES SysUtils, Windows;

Var
Ls: variant;

The function crashrmb (ls: Variant) : string;//1. Define functions num_str
Implementation

The function crashrmb (ls: Variant) : string;//1. Define functions num_str
Var
Dx_sz dx_dw, str_int str_dec, dx_str, fu: string;
A, b, b2, c, d: string;
Num_int num_dec, len_int, I, a_int, pp: integer;
//dx_str to return a string
The begin
Dx_sz:='zero remark 3 boss wu lu and pure nine';
Dx_dw:='than thousand hundred thousands pick up hundred thousand hundred thousand hundred yuan';
//processing amount is less than zero is
If the ls & lt; 0 then
The begin
Ls:=ls * (1);
Fu:='negative';
End the else fu:=';
//integer value and an integer string
Dx_str:=ls;
If (ls & gt; 0) and (ls & lt; 1) then dx_str:='0' + dx_str;
Pp:=pos ('. ', dx_str);
If the pp & gt; 0 then str_int:=copy (dx_str, 1, pos ('. ', dx_str) - 1)
The else str_int:=dx_str;
Num_int:=strtoint (str_int);
//small Numbers and the decimal string
If (ls & gt; 0) and (ls & lt; 1) then num_dec: ls * 100=
The else num_dec:=(ls - num_int) * 100;
Str_dec:=inttostr (num_dec);
Len_int:=Length (str_int);
Dx_str:=';
//convert the integer part
For I:=1 to len_int do
The begin
//a digital characters to lowercase, b for the corresponding uppercase characters
For the corresponding capital unit//c, d for current uppercase string last Chinese characters
A:=copy (str_int, I, 1);
A_int:=strtoint (a);
B:=copy (dx_sz (a_int * 2 + 1), 2);
C:=copy (dx_dw, ((13 - len_int + I - 1) * 2 + 1), 2);
If dx_str & lt;> "' then
D:=copy (dx_str, Length (dx_str) - 1, 2)
The else d:=';
='zero' if (b) and ((d='0') or (b=b2) or (c='$') or (c=' m ') or (c='$')) then: b=' ';
If (a='0') and (c & lt;> '$') and (c & lt;> 'm') and (c & lt;> A '$') then c:=';
If (='$' (c) or (c=' m ') or (c='$')) and (d=' 0 ') and (a='0') then
The begin
Dx_str:=copy (dx_str, 1, Length (dx_str) - 2);
D:=copy (dx_str, Length (dx_str) - 1, 2);
If (='$' (c) and (d=' m ')) or ((c='m') and (d='$')) then c:=' ';
The end;
Dx_str:=dx_str + b + c; B2:=b;
The end;
//processing amount is less than 1
the condition of theIf Length (dx_str) & lt;=2 then dx_str:=';
//convert the decimal part
If (num_dec & lt; 10) and (ls & gt; 0) then
The begin
A_int:=strtoint (str_dec);
B:=copy (dx_sz (a_int * 2 + 1), 2);
If num_dec=0 then dx_str:=dx_str + 'whole';
If num_dec & gt; 0 then dx_str:=dx_str + 'zero' + b + 'points';
The end;
If num_dec & gt; 10 then=
The begin
A_int:=strtoint (copy (str_dec, 1, 1));
A:=copy (dx_sz (a_int * 2 + 1), 2);
A_int:=strtoint (copy (str_dec, 2, 1));
B:=copy (dx_sz (a_int * 2 + 1), 2);
If a & lt;> 'zero' then a:=a + 'Angle';
If b & lt;> 'zero' then: b=b + 'points'
The else: b=' ';
Dx_str:=dx_str + a + b;
The end;
If the ls=0 then dx_str:='zero dollars;
Dx_str:=fu + dx_str;
//function returns a string
Result:=dx_str;
The end;
{2) method is called
Function parameters using the Variant type, called the parameter value can be a real type, also can be a string, is very convenient and below
Example:
New window, in the corresponding pas num_str function is added to file, and add in the window for the and Edit1 Edit2 controls, double-click the following code for the input, run the program to:
Procedure TForm1. Button1Click (Sender: TObject);
The begin
Edit1. Text:=num_str (202055010.32); nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related