你先copy最后三个字母,看是不是and,如果是就用delete或者StringReplace去掉。

解决方案 »

  1.   

    不动脑子的方法。
    where
    1=1
    and
    ...
    and
    ...
    明白?and 都加再前面。
      

  2.   

    var 
         str,str2:string;
    strcount:=length(str);
    setlength(str2,strcount-2);
    if str[strcont]='d' and str[strcount-1]='n' and str[strconur-2]='a' then
          for i:=1 to strcount-2 do
          begin
                setlength(str2,strcount-2);
                str2:=str[i];
          end;
      

  3.   

    length(s):s的长度
    copy(s,n,m)从s里拷贝第n个开始的m个子串
    delete(s,n,m)删除s里第n个开始的m个字符
      

  4.   

    这样不行,前面会多一个‘AND’
      

  5.   

    var 
        str,str2:string;
    strcount:=length(str);
    setlength(str2,strcount-2);
    if str[strcont]='d' and str[strcount-1]='n' and str[strconur-2]='a' then
          for i:=1 to strcount-2 do
          begin
                str2:=str[i];
          end;
      

  6.   

    function copy(s:string;index,count:integer):string
    意思:比如S=abcdef,copy(abcdef,4,6)的结果就是def,同样delete(abcdef,4,6)就是删除def;
      

  7.   

    var
      SourceStr,str2:string;
    begin
      SourceStr:='asdfasdfsdfasd111and';
      if Copy(SourceStr,Length(SourceStr)-2,3)='and' then
        Str2:=Copy(SourceStr,1,Length(SourceStr)-3);
    end;