主题:请高手帮我看看这段代码
功能是日期的小写转大写
RUN的时候报错,说VAR前有END 不知道是哪里的错
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, DateUtils, math;
type
TForm1 = class(TForm)
Button1: TButton;
Memo1: TMemo;
function YearToChinese(yearofdate : Currency):string;
function MonthToChinese(Monthofdate : currency) :string;
function DayToChinese(Dayofdate : currency):string;
var iNumLength:Integer;//数字长度
i,j:Integer;
sNumber:String;
arALB:Array [0..9] of String;
Form1: TForm1;
S: string;
T: TDateTime;
begin
arALB[0]:='零'; arALB[1]:='壹';
arALB[2]:='贰'; arALB[3]:='叁';
arALB[4]:='肆'; arALB[5]:='伍';
arALB[6]:='陆'; arALB[7]:='柒';
arALB[8]:='捌'; arALB[9]:='玖';
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
implementation
{$R *.dfm}
function YearToChinese(yearofdate : Currency):string;
begin
var
ChineseofYear:array [0..3] of string;
sNumber:=inttostr(yearofdate);
iNumLength := StrLen(sNumber);
for i:=1 to iNumLength do
begin
j:=strtoint(Copy(sNumber,i,1));
ChineseofYear[i-1]:=arALB[j];
end; //end for
Result:=chineseofyear;
end;
function MonthToChinese(Monthofdate : currency) :string;
begin
var
Chineseofmonth:array [0.1] of string;
sNumber := inttostr(Monthofdate);
iNumLength := StrLen(sNumber);
for i := 1 to iNumLength do
begin
j:=strtoint(copy(sNumber,i,l));
Chineseofmonth[i-1] := arALB[j];
end;//end for
if chineseofmonth <>'零' then
Result := Chineseofmonth[0] + '拾' + chineseof[1];
else
Result := Chineseofmonth;
end;//end if
end;
function DayToChinese(Dayofdate : currency) :string;
begin
var
Chineseofday:array [0.1] of string;
sNumber := inttostr(Dayofdate);
iNumLength := StrLen(sNumber);
for i := 1 to iNumLength do
begin
j:=strtoint(copy(sNumber,i,l));
Chineseofmonth[i-1] := arALB[j];
end;//end for
if chineseofmonth <>'零' then
Result := Chineseofmonth[0] + '拾' +chineseof[1];
else
Result := Chineseofmonth;
end;//end if
end;
function DayToChinese(Dayofdate : currency):string;
procedure TForm1.Button1Click(Sender: TObject);
begin
T := now();
S := yeartochinese ( yearof(t)) ;
memo1.Lines.Clear;
memo1.Lines.add(s);
s := monthtochinese (monthof(t));
memo1.lines.add(s);
s := daytochinese (dayof(t));
memo1.lines.add(s);
end.
RUN的时候报错,说VAR前有END 不知道是哪里的错
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, DateUtils, math;
type
TForm1 = class(TForm)
Button1: TButton;
Memo1: TMemo;
function YearToChinese(yearofdate : Currency):string;
function MonthToChinese(Monthofdate : currency) :string;
function DayToChinese(Dayofdate : currency):string;
var iNumLength:Integer;//数字长度
i,j:Integer;
sNumber:String;
arALB:Array [0..9] of String;
Form1: TForm1;
S: string;
T: TDateTime;
begin
arALB[0]:='零'; arALB[1]:='壹';
arALB[2]:='贰'; arALB[3]:='叁';
arALB[4]:='肆'; arALB[5]:='伍';
arALB[6]:='陆'; arALB[7]:='柒';
arALB[8]:='捌'; arALB[9]:='玖';
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
implementation
{$R *.dfm}
function YearToChinese(yearofdate : Currency):string;
begin
var
ChineseofYear:array [0..3] of string;
sNumber:=inttostr(yearofdate);
iNumLength := StrLen(sNumber);
for i:=1 to iNumLength do
begin
j:=strtoint(Copy(sNumber,i,1));
ChineseofYear[i-1]:=arALB[j];
end; //end for
Result:=chineseofyear;
end;
function MonthToChinese(Monthofdate : currency) :string;
begin
var
Chineseofmonth:array [0.1] of string;
sNumber := inttostr(Monthofdate);
iNumLength := StrLen(sNumber);
for i := 1 to iNumLength do
begin
j:=strtoint(copy(sNumber,i,l));
Chineseofmonth[i-1] := arALB[j];
end;//end for
if chineseofmonth <>'零' then
Result := Chineseofmonth[0] + '拾' + chineseof[1];
else
Result := Chineseofmonth;
end;//end if
end;
function DayToChinese(Dayofdate : currency) :string;
begin
var
Chineseofday:array [0.1] of string;
sNumber := inttostr(Dayofdate);
iNumLength := StrLen(sNumber);
for i := 1 to iNumLength do
begin
j:=strtoint(copy(sNumber,i,l));
Chineseofmonth[i-1] := arALB[j];
end;//end for
if chineseofmonth <>'零' then
Result := Chineseofmonth[0] + '拾' +chineseof[1];
else
Result := Chineseofmonth;
end;//end if
end;
function DayToChinese(Dayofdate : currency):string;
procedure TForm1.Button1Click(Sender: TObject);
begin
T := now();
S := yeartochinese ( yearof(t)) ;
memo1.Lines.Clear;
memo1.Lines.add(s);
s := monthtochinese (monthof(t));
memo1.lines.add(s);
s := daytochinese (dayof(t));
memo1.lines.add(s);
end.