W wglifs Unregistered / Unconfirmed GUEST, unregistred user! 2007-07-17 #1 如题,有一字符串abcdefg.aaa,由于'.'前面的字符串的长度不固定,我都想要,所以要删除后面的四个字符,即.aaa,应该怎样做?
李 李翔鹏 Unregistered / Unconfirmed GUEST, unregistred user! 2007-07-17 #3 var Str : string; begin Str := Copy(Str,1,Pos(Str,'.') -1) end;
水 水影8888 Unregistered / Unconfirmed GUEST, unregistred user! 2007-07-17 #4 var s1:string; i:Integer; begin s1 :='abcdefg.aaa'; i := Pos('.',s1); if i>0 then s1 := Copy(s1,1,i-1);
var s1:string; i:Integer; begin s1 :='abcdefg.aaa'; i := Pos('.',s1); if i>0 then s1 := Copy(s1,1,i-1);
I icc Unregistered / Unconfirmed GUEST, unregistred user! 2007-07-17 #5 {从后面截去字符串的指定长度} procedure RightDecStr(var S: string; const ACount: Integer = 1); begin Delete(S, Length(S) - ACount + 1, ACount); end;
{从后面截去字符串的指定长度} procedure RightDecStr(var S: string; const ACount: Integer = 1); begin Delete(S, Length(S) - ACount + 1, ACount); end;