delphi - 如何在 Delphi IDE 中观察/检查字符串列表范围?

标签 delphi range tstringlist

我经常发现自己处于调试字符串列表部分发生的情况的情况, 例如正在处理 StringList[StartOfBlock] 到 StringList[EndOfBlock] 范围内的数据。 该范围内的一个或多个变量索引可能是可用的,我可以快速检查或观察,例如StringList[LineNum],但是检查 StartBlock/Endblock 范围内的相邻字符串很麻烦。 我可以在 StringList[LineNum+1] 上添加另一个监视,或者修改 Ctrl-F7 检查器中的表达式,但工作量太大了;-(

我希望在 IDE 中永久显示 StringList[StartOfBlock] 到 StringList[EndOfBlock]。 (如果该 View 在 StartOfBlock/EndOfBlock 更改时发生更改,或者该 View 可以刷新,那就太好了。)

我如何在“IDE 中”构建一些东西来实现这一目标?

最佳答案

创建全局函数:

function GetLines(AList: TStrings; AStart, AEnd: Integer): string;
var
  I: Integer;
begin
  Result := '';
  for I := AStart to AEnd do
    if I < AList.Count then
      Result := Result + AList[I] + sLineBreak;
end;

您可以观看此功能: GetLines(字符串列表, block 开始, block 结束) 但在 watch 设置中启用函数执行(允许函数调用复选框)。

关于delphi - 如何在 Delphi IDE 中观察/检查字符串列表范围?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11028259/

相关文章:

delphi - 调用 ShowModal 时,表单隐藏在其他表单后面

delphi - 如何自定义滚动条颜色?

Delphi 汇编器/RTTI 专家 : Can I obtain the memory address and type info of the implied Result variable in a function?

delphi - 在排序的 TStringList 中搜索带有前缀 (StartsText) 的条目

multithreading - TStringList 线程安全吗?

delphi - 是否可以在delphi中仅在设计时使用库?

c++ - Range-for-loops 和 std::vector<bool>

jquery - Internet Explorer 不会显示范围 slider 或使用 jquery 更新 CSS

HighCharts 堆积柱形范围

Delphi:即使设置了 Delimiter,TStringList Delimiter 也始终是空格字符