var i: integer; begin i:=Pos(',',labe13.caption); label13.caption:=Copy(labe13.caption,i+1,Length(labe13.caption)-i)+','+Copy(labe13.caption,1,i-1); end;
'abc,def' 是要变成'fed,cba' 要变成'def,abc' procedure TForm1.BitBtn1Click(Sender: TObject); var str:string; i:integer; begin str:='abc,def'; i:=Pos('c',str); str:=RightStr(str,Length(str)-i-1)+','+Leftstr(str,i); Label1.Caption:=str; end;
我的字符串有几千个 'abc,def',楼上的方法到也是可行的
那怎么样把 edit.text变成string类型呀
var str:string; srt:=edit.text直接引用不行吗?
我str定义的是packed array[0..9] of char,当定义成string[10]就可以,不知前者为什么不行?
是不是如楼上所说没有uses strUtils
你的问题是什么?
'abc,def'
是要变成'fed,cba'
还是'def,abc'
谢谢!
i: integer;
begin
i:=Pos(',',labe13.caption);
label13.caption:=Copy(labe13.caption,i+1,Length(labe13.caption)-i)+','+Copy(labe13.caption,1,i-1);
end;
'abc,def'
是要变成'fed,cba'
要变成'def,abc'
procedure TForm1.BitBtn1Click(Sender: TObject);
var
str:string;
i:integer;
begin
str:='abc,def';
i:=Pos('c',str);
str:=RightStr(str,Length(str)-i-1)+','+Leftstr(str,i);
Label1.Caption:=str;
end;
str:string;
srt:=edit.text直接引用不行吗?