相关疑难解决方法(0)

适用于Delphi的最佳轻量级HTML解析器

我需要从选择框中的一些数据中解析出值.

示例:<option value ="1"> Apple </ option> <option value ="2"> Chicken </ option>

用法:如果option = apple则获取值.

有什么建议?

html delphi parsing delphi-2009 delphi-2010

7
推荐指数
1
解决办法
3925
查看次数

在Delphi中删除标签之间变量子字符串的所有实例

我正在将HTML中的可读文本提取为字符串,并且需要删除<!---->标记之间的现有文本。实现这一目标的最有效方法是什么?

现在,我正在这样做:

function RemoveIEScripts(const s: string): string;
var
  i: Integer;
  InTag: Boolean;
begin
   Result := '';
   InTag := False;
   for i := 1 to Length(s)-3 do
   begin
      if (s[i] = '<') and (s[i+1] = '!') and (s[i+2] = '-') then
         inTag := True
      else if (s[i] = '-') and (s[i+1] = '-') and (s[i+2] = '>') then
             inTag := False
           else if not InTag then
      Result := Result + s[i];
   end;
end;
Run Code Online (Sandbox Code Playgroud)

有一个更好的方法吗?

delphi delphi-xe

2
推荐指数
1
解决办法
899
查看次数

标签 统计

delphi ×2

delphi-2009 ×1

delphi-2010 ×1

delphi-xe ×1

html ×1

parsing ×1