interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,StrUtils, Spin;
type
TForm1 = class(TForm)
Edit1: TEdit;
Edit2: TEdit;
Button1: TButton;
Button2: TButton;
SpinEdit1: TSpinEdit;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
function nospace(s:string):string;
begin
result:= stringreplace(s,\' \',\'\',[rfReplaceAll]);
end;
function is123(c:char):boolean;
begin
if c in [\'0\'..\'9\',\'.\']
then result:=true
else result:=false;
end;
function isminus(s:string;i:integer):boolean ;
var
t:integer;
begin
for t:=i-1 downto 1 do
begin
if s[t]=\')\' then
begin
result:=false;
break;
end;
if (s[t]=\'(\') and (s[t+1]=\'-\') then
begin
result:=true;
break;
end;
if (not is123(s[t])) and ( not ((s[t]=\'-\') and(s[t-1]=\'(\'))) then
begin
result:=false;
break;
end;
end;
end;
function firstJ(s:string):integer ;
var
i,L:integer;
begin
result:=0;
L:=length(s);
for i:=1 to L do
begin
if (s[i]=\')\') and (not isminus(s,i)) then
begin
result:=i;
break;
end;
end;
end;
责任编辑:小草