function DecodePJItem(sText: string): TList<TDataItem>;
var
reg: TRegEx;
mc: TMatchCollection;
item: TMatch;
dataItem: TDataItem;
begin
Result := TList<TDataItem>.Create;
sText := reg.Replace(sText, '\n', '');
sText := reg.Replace(sText, '<tr style="">.*?</tr>', ''); //
sText := reg.Replace(sText, '<td width=".*?">', '');
sText := reg.Replace(sText, '<span class.*?">', '');
sText := reg.Replace(sText, '<td class=.*?>', '');
sText := reg.Replace(sText, '<p class.*?>', '');
sText := reg.Replace(sText, '<input .*?>', '');
sText := reg.Replace(sText, '<a.*?>', '');
sText := reg.Replace(sText, '</a>', '');
sText := reg.Replace(sText, '</span>', '');
sText := reg.Replace(sText, '</tr>', '|');
sText := reg.Replace(sText, '<tr>', '');
sText := reg.Replace(sText, '</p>', '');
sText := reg.Replace(sText, '</td>', ',');
sText := reg.Replace(sText, '<span.*?>', '');
reg := TRegEx.Create('(.*?),(.*?),(.*?),(.*?),(.*?),(.*?),(.*?),(.*?),\|');
mc := reg.Matches(sText); for item in mc do
begin
if item.Groups.Count = then
begin
try
if item.Groups[].Value <> '我要买' then Continue; dataItem := TDataItem.Create;
dataItem.PublishTime := item.Groups[].Value;
dataItem.Company := item.Groups[].Value;
dataItem.Money := StrToFloatDef(item.Groups[].Value, );
dataItem.OutTime := item.Groups[].Value;
dataItem.Deduction := StrToIntDef(item.Groups[].Value, );
dataItem.Defect := item.Groups[].Value;
dataItem.TimeLength := item.Groups[].Value;
dataItem.Text := item.Groups[].Value;
dataItem.LeftDay := GetLeftValue(dataItem.OutTime); if dataItem.LeftDay <= then
begin
SendLog(TDataCollector.MainHandle,
Format('%s, %s, 数据异常,跳过!!!',[dataItem.PublishTime, dataItem.Company]));
dataItem.Free;
Continue;
end;
dataItem.YearRate := dataItem.Deduction / * / DataItem.LeftDay;
dataItem.New := True;
except
Continue;
end; Result.Add(dataItem);
end;
end;
end;

update20181214 - uGetHttpData.pas的更多相关文章

  1. GetPJData - uGetHttpData.pas

    function GetPJData(APage: Integer): string; var IdHTTP: TIdHTTP; url: string; paramsList: TStringLis ...

  2. Delphi项目构成之单元文件PAS

    单元文件是Pascal源文件,扩展名为.pas. 有三种类型的单元文件: 窗体/数据模块和框架的单元文件(form/data module and frame units),一般由Delphi自动生成 ...

  3. Delphi 包的设计思想及它与PAS、BPL、DCU、DLL、OXC的关系。

    DCP ,BPL分别是什么文件,起什么作用?你在DELPHI中建立一个package然后保存一下,看看. bpl和Dll比较相似.只是BPL是BORLAND自己弄出来的东西!!!调用也和调用DLL相似 ...

  4. 5、利用控件TVCLZip和TIdFTP压缩文件并上传到FTP的线程单元pas 改进版

    用到临界区 保护写日志的函数: 递归函数 删除目录下的所有文件: 循环创建或判断FTP的目录: 可改进的地方:循环压缩深层次目录的所以文件: 实现断点续传,或断点下载: {************** ...

  5. F2063 Could not compile used unit 'tt.pas'

    install packge error F2063 Could not compile used unit 'tt.pas' 有可能是工程的pas文件相对路径不对.在工程管理看是否能打开文件,如果打 ...

  6. Android问题-XE5提示"[DCC Fatal Error] Project1.dpr(1): F1027 Unit not found: 'System.pas' or binary equivalents (.dcu/.o)"

    问题现象:Checking project dependencies...Compiling Project1.dproj (Debug, Android)dcc command line for & ...

  7. Messages.pas里的消息

    一.Windows 消息大全 这张表拷贝自万一兄的帖子:http://www.cnblogs.com/del/archive/2008/02/25/1079970.html 但是我希望自己能把这些消息 ...

  8. 问题-RZ安装后报错“RzBorder.pas”

    错误象现:[Error] RzBorder.pas(1429): Number of elements differs from declaration [Fatal Error] RzEdit.pa ...

  9. 问题-[致命错误] Project1.dpr(1): Unit not found: 'System.pas' or binary equivalents (DCU,DPU)

    问题现象:[致命错误] Project1.dpr(1): Unit not found: 'System.pas' or binary equivalents (DCU,DPU) 问题原因:由于删除D ...

随机推荐

  1. jQuery中有关each方法的使用

    概述: each() 方法规定为每个匹配元素规定运行的函数. 返回 false 可用于及早停止循环,相当于break. 返回 true 可以结束本次循环,相当于continue. 语法: $(sele ...

  2. [转载] java多线程总结(二)

    转载自:http://www.cnblogs.com/lwbqqyumidi/p/3817517.html 作者:Windstep 四.Java多线程的阻塞状态与线程控制 上文已经提到Java阻塞的几 ...

  3. 在Servlet中获取spring容器WebApplicationContext

    WebApplicationContext springContext = WebApplicationContextUtils.getRequiredWebApplicationContext(ge ...

  4. mysql_pconnect 问题

    不同于mysql_connect的短连接,mysql_pconnect持久连接的时候,将先尝试寻找一个在同一个主机上用同样的用户名和密码已经打开的(持久)连接,如果找到,则返回此连接标识而不打开新连接 ...

  5. Centos7.4 防火墙配置

    # service firewalld status; #查看防火墙状态 (disabled 表明 已经禁止开启启动 enable 表示开机自启,inactive 表示防火墙关闭状态 activate ...

  6. Win32线程——等待另一个线程结束

    转载: https://blog.csdn.net/yss28/article/details/53646627 <Win32多线程程序设计>–Jim Beveridge & Ro ...

  7. Spring xml配置

    <?xml version="1.0" encoding="UTF-8" ?> <beans xmlns="http://www.s ...

  8. 安装activeMQ(window,linux系统)

    今天学习了activeMQ服务器,把它说成成服务器是我的理解,,呵呵,首先,说一下它的安装, 官网:http://activemq.apache.org/overview.html window下的安 ...

  9. Debug程序的使用

    一.什么是Debug程序: Debug是DOS, Windows(但是Win7 64位没有,8 10不清楚.)都提供的实模式程序的调试工具, 使用它,可以查看CPU各种寄存器中的内容,内存的情况和在机 ...

  10. newinstance()和new有什么区别?

    在初始化一个类,生成一个实例的时候:newInstance() 和 new 有什么区别?用newInstance与用new是区别的,区别在于创建对象的方式不一样,前者是使用类加载机制,那么为什么会有两 ...