//判断类型及是否符合类型值函数
function TReportForm.ControlType(FType : TNrType ; FValue : String): Boolean;
Var
i : integer;
function CountSubStr(SubStr, Source: string): Integer;
begin
result := 0;
while pos(SubStr, Source)<> 0 do
begin
inc(result);
Source := copy(Source, pos(SubStr, Source)+Length(SubStr), $7FFFFFFF);
end;
end;
begin
Result := True;
if FType = DrMoney then
begin
if CountSubStr('.',FValue) > 1 then Result := False; //'.'大于1个
For i := 1 to Length(FValue) do
if not (FValue[i] in ['0'..'9','.','$']) then Result := False; //非法字符
if not Result then exit;
end //DRMoney
else if FType = DrNum then
begin
For i := 1 to Length(FValue) do
if not (FValue[i] in ['0'..'9']) then Result := False; //非法字符
end//Drint
else if FType = DrTel then
begin
if CountSubStr('-',FValue) > 1 then Result := False; //'-'大于1个
For i := 1 to Length(FValue) do
if not (FValue[i] in ['0'..'9','-']) then Result := False; //非法字符
if not Result then exit;
end //DrTel
else if FType = DrEmail then
begin
if CountSubStr('@',FValue) <> 1 then
begin
Result := False; //'.'大于1个
exit;
end;
end;
end;