分割有规律的字符的函数

  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;

原文地址:https://www.cnblogs.com/sail2000/p/1771120.html