不是不理你,而是我昨晚忙。
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Mask, StdCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Button1: TButton;
MaskEdit1: TMaskEdit;
procedure Button1Click(Sender: TObject);
private
function LowToUpper(pDate:String):String;
function MToStr(pMonth:String):String;
function NumToStr(pNum:String):String;
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
{ TForm1 }
function TForm1.LowToUpper(pDate: String): String;
var s1,s2:String;
begin
s1:=Copy(PDate,1,4);
s2:=NumToStr(Copy(S1,1,1));
s2:=S2+NumToStr(S1[2]);
s2:=S2+NumToStr(S1[3]);
s2:=S2+NumToStr(S1[4])+'年';
s1:=Copy(PDate,6,2);
s2:=S2+MToStr(S1)+'月';
s1:=Copy(PDate,9,2);
s2:=S2+MToStr(S1)+'日' ;
Result:=S2;
end;
function TForm1.MToStr(pMonth: String): String;
var p
char;
s1,s2:String;
begin
p:=pchar(pMonth);
if p[0]='0' then
s1:='零';
if p[0]='1' then
s1:='拾';
if p[0]='2' then
s1:='贰拾';
if p[0]='3' then
s1:='参拾';
if p[1]<>'0' then
s2:=NumToStr(P[1]);
Result:=S1+S2;
end;
function TForm1.NumToStr(pNum: String): String;
var i:Integer;
s:String;
begin
i:=StrToInt(pNum);
case i of
1:s:='壹';
2:s:='贰';
3:s:='参';
4:s:='肆';
5:s:='伍';
6:s:='陆';
7:s:='柒';
8:s:='捌';
9:s:='九';
0:s:='零';
end;
Result:=s;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
Edit1.Text:=LowToUpper(MaskEdit1.Text);//MaskEdit的EditMask='9999-99-99'
end;
end.