发信人: plenilune88(望月) 
整理人: soaringbird(2002-02-02 09:05:14), 站内信件
 | 
 
 
function LeftStr(S:string;Count:integer):string;
 begin  //获取字符串左边起n个字符
   LeftStr:=Copy(s,1,Count);
 end;
 
 function RightStr(S:string;Count:integer):string;
 begin  //获取字符串右边起n个字符
   RightStr:=Copy(s,Length(s)-Count+1,Count);
 end;
 
 function ReplaceStr(S:string;OldStr,NewStr:string):string;
 var i,j:integer;
     ss:string;
 begin  //替换字符串 (其实Delphi已经提供对应的函数了StringReplace)
   i:=1;
   ss:='';
   j:=length(OldStr);
   while i<=length(s) do
   begin
     if LowerCase(copy(s,i,j))=LowerCase(OldStr)
     then
       begin
         ss:=ss+NewStr;
         inc(i,j);
       end
     else
       begin
         ss:=ss+s[i];
         inc(i,1); 
       end;
   end;
   Result:=ss;
 end;
 
 function LTrim(S:string):string;
 begin  //删除字符串左边空格
   s:=s+'*';
   s:=Trim(s);
   Delete(s,length(s),1);
 end;
 
 function RTrim(S:string):string;
 begin  //删除字符串右边空格
   s:='*'+s;
   s:=Trim(s);
   Delete(s,1,1);
 end;
 
 function LDelete(S,Sub:string):string;
 begin  //删除字符串左边的某一所有字符
   while LeftStr(S,1)=sub do
     Delete(S,1,1);
   LDelete:=s;
 end;
 
 function RDelete(S,Sub:string):string;
 begin  //删除字符串右边的某一所有字符
   sub:=copy(sub,1,1);
   while RightStr(S,1)=sub do
     Delete(S,length(s),1);
   RDelete:=s;
 end;
 
 function MDelete(S,Sub:string):string;
 begin  //删除字符串中包含的某一所有字符
   sub:=copy(sub,1,1);
   while Pos(sub,s)>0 do
     Delete(S,Pos(sub,s),1);
   MDelete:=s;
 end;
 
 function GetCodeNo(NoStr:string;NoLen:integer):string;
 begin  //生成一个在数字前面自动补零编码
   NoStr:=Trim(NoStr);
   Result:=copy('00000000000000000000',1,NoLen-length(NoStr))+NoStr;
 end;
 
 //中大方略版权所有
 //www.cnflag.net
 
  ----                 .-'''''-.
              .'         `.
             :             :
            :               :
            :      _/|      :
             :   =/_/      :
              `._/ |     .'
           (   /  ,|...-'
            \_/^\/||__
         _/~  `""~`"` \_
      __/  -'/  `-._ `\_\__
    /     /-'`  `\   \  \-.\ 
 
 孤意望月 血泪无痕 
 
 http://plenilune.top263.net
 http://www.cnflag.net   | 
 
 
 |