C++ 技术中心

   :: 首页 :: 联系 ::  :: 管理
  160 Posts :: 0 Stories :: 87 Comments :: 0 Trackbacks

公告

郑重声明:本BLOG所发表的原创文章,作者保留一切权利。必须经过作者本人同意后方可转载,并注名作者(天空)和出处(CppBlog.com)。作者Email:coder@luckcoder.com

留言簿(27)

搜索

  •  

最新随笔

最新评论

评论排行榜

Function Before( Src:string ; S:string ): string ;
var
  F: Word ;
begin
  F:= POS(Src,S) ;
  if F=0 then
    Before := S
  else
    Before := COPY(S,1,F-1) ;
end ;

function After(Src: string; S: string):string;
var
  F: Word;
begin
  F:= Pos(Src, S);
  if F = 0 then
      After:= ''
  else
      After:= Copy(S, F+Length(Src), Length(S));
end;



  tmp := '1232$$23423432';

  showmessage(Before('$$',tmp));
  showmessage(after('$$',tmp));






function SplitString(const source, ch: string): TStringList;
var
  temp, t2: string;
  i: integer;
begin
  result := TStringList.Create;
  temp := source;
  i := pos(ch, source);
  while i <> 0 do
  begin
    t2 := copy(temp, 0, i - 1);
    if (t2 <> '') then
      result.Add(t2);
    delete(temp, 1, i - 1 + Length(ch));
    i := pos(ch, temp);
  end;
  result.Add(temp);
end;

procedure TForm1.Button1Click(Sender: TObject);
var
 st : TStringList;
begin
  st := SplitString('xxx@hoho.com', '@');
  showmessage(st[1]);
end;


posted on 2013-09-17 19:47 C++技术中心 阅读(1372) 评论(0)  编辑 收藏 引用 所属分类: Delphi

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理