delphi編寫函數,出現over flow

//對大字符操作,每個字符串大概3000-5000字節
procedure Texchanger.AnalysisDepthData(value,asks,bids,splitstr,ADelim: string);
var
  apos,bpos,ipos:Integer;
  str,stmp,stra,strb:string;
  i,j:Integer;
begin
  stmp := StringReplace(value,splitstr,'^',[]);
  stmp := StringReplace(stmp,ADelim,'`',[rfReplaceAll]);
  SetLength(str,Length(stmp));
  j := 1;
  for i:= 1 to Length(value) do
  begin
    if (stmp[i]='"')or(stmp[i]='[')or(stmp[i]=']')or(stmp[i]='{')or(stmp[i]='}')or(stmp[i]=#13)or(stmp[i]=#10)or(stmp[i]=':') then
      Continue
    else
    begin
      str[j] := stmp[i];
      inc(j);
    end;
  end;
  <span style="color:#ff0000;">stmp := '';             //如果沒有這句話,會出現over flow提示框</span>
  apos := Pos(asks,str);
  bpos := Pos(bids,str);
  ipos := Pos('^',str);
  if apos < bpos then
  begin
    stra := Copy(str,apos+length(asks),ipos - apos - Length(asks));
    strb := Copy(str,bpos+length(bids),Length(str));
  end
  else
  begin
    strb := Copy(str,bpos+length(bids),ipos - bpos - Length(bids));
    stra := Copy(str,apos+length(asks),Length(str));
  end;
  SplitDelimitedString(stra,asksList,True,'`');//SplitColumns();
  SplitDelimitedString(strb,bidsList,True,'`');
end;

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章