分割有规律的字符的函数

 

  function MyStr(ASource: string; Index: Integer): string;
  var
    st: TStrings;
    i: Integer;
  begin
    Result := '';
    st := TStringList.Create;
    i := ExtractStrings([';'], [], PChar(ASource), st);
    if (i > 0) and (Index in [0 .. i - 1]) then
      Result := st.ValueFromIndex[Index];
    st.Free;
  end;

begin
  Caption := MyStr('CD=123;EE=23;KK=266;', 0)
end;

 

 

posted on 2010-07-05 08:54  思想。生活。网络  阅读(108)  评论(0编辑  收藏  举报

导航