好象没有函数可以这么做,但是我可以有一个算法给你,除空格,或者指定的字符也行:
function trimchar(S,ch:string);
i:=pos(ch,s);
While i<>0 do 
  begin
     delete(S,I,1);
     i:=pos(ch,s);
  end
其中S为你处理的字符串,ch为需要去除的字符。

解决方案 »

  1.   

    trim,trimleft,trimright以及下面一组函数
    还有什么对付不了?:)
    function LeftStr(OrgStr: string; CharCount: smallint): string;
    begin
     try
      result:=Copy(OrgStr,0,CharCount);
     except
      result:='';
     end;
    end;function RightStr(OrgStr: string; CharCount: smallint): string;
    begin
     result:=Copy(OrgStr,(Length(OrgStr)-CharCount)+1,Length(OrgStr));
    end;function DeleteChars(OrgStr: string; CharPos, CharCount: smallint): string;
    begin
     result:=LeftStr(OrgStr,CharPos)+RightStr(OrgStr,Length(OrgStr)-CharPos-CharCount);
    end;function InsertChars(OrgStr, InsChars: string; CharPos : smallint): string;
    begin
     result:=LeftStr(OrgStr,CharPos)+InsChars+RightStr(OrgStr,Length(OrgStr)-CharPos);
    end;function ReplaceChars(OrgStr, ReplChars: string; CharPos : smallint): string;
    begin
     result:=LeftStr(OrgStr,CharPos)+ReplChars+RightStr(OrgStr,Length(OrgStr)-CharPos-Length(ReplChars));;
    end;function ReplaceChars2(OrgStr: string; ReplChar: Char; CharPos, CharCount : smallint): string;
    var x: smallint;
    begin
     result:=OrgStr;
     for x:=0 to CharCount-1 do
     begin
      result:=ReplaceChars(result,ReplChar,CharPos+x);
     end;
    end;
      

  2.   

    delphi中没有,
    LMDReplaceChar(s,' ','');function LMDReplaceChar(const aValue:String; toReplace, Replace:Char):String;
    var
      i:Integer;
    begin
      result:=aValue;
      for i:=1 to Length(result) do
        if result[i]=toReplace then result[i]:=Replace;
    end;
      

  3.   

    too easy!
    function trimchar(Str,char:string):String;
    begin
      while Pos(char,Str)>0 do
        Str:=copy(Str,1,pos(char,Str)-1)+copy(Str,pos(char,Str)+1,Length(Str));
      Result:=Str;
    end;
      

  4.   

    没有什么现成的函数,不过用POS等函数首先查找到空格,然后在DELETE掉不就行啦
      

  5.   

    :)
    i := pos(s,' ');
    while (i <> 0) do
    begin
     delete(s,i);
     i := pos(s,' ');
    end;
      

  6.   

    来自Rxlib的strutils:
    function DelSpace(const S: string): string;
    { DelSpace return a string with all white spaces removed. }function DelChars(const S: string; Chr: Char): string;
    { DelChars return a string with all Chr characters removed. }function DelChars(const S: string; Chr: Char): string;
    var
      I: Integer;
    begin
      Result := S;
      for I := Length(Result) downto 1 do begin
        if Result[I] = Chr then Delete(Result, I, 1);
      end;
    end;
    function DelSpace(const S: String): string;
    begin
      Result := DelChars(S, ' ');
    end;