惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

H
Help Net Security
博客园 - Franky
GbyAI
GbyAI
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
爱范儿
爱范儿
IT之家
IT之家
酷 壳 – CoolShell
酷 壳 – CoolShell
aimingoo的专栏
aimingoo的专栏
博客园_首页
MongoDB | Blog
MongoDB | Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Recent Announcements
Recent Announcements
Scott Helme
Scott Helme
有赞技术团队
有赞技术团队
M
MIT News - Artificial intelligence
C
CERT Recently Published Vulnerability Notes
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Jina AI
Jina AI
F
Fortinet All Blogs
N
Netflix TechBlog - Medium
L
LangChain Blog
L
LINUX DO - 最新话题
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
H
Hacker News: Front Page
MyScale Blog
MyScale Blog
P
Palo Alto Networks Blog
G
Google Developers Blog
Google DeepMind News
Google DeepMind News
AI
AI
T
Troy Hunt's Blog
Microsoft Azure Blog
Microsoft Azure Blog
阮一峰的网络日志
阮一峰的网络日志
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Vercel News
Vercel News
Microsoft Security Blog
Microsoft Security Blog
罗磊的独立博客
S
Secure Thoughts
大猫的无限游戏
大猫的无限游戏
博客园 - 叶小钗
人人都是产品经理
人人都是产品经理
Blog — PlanetScale
Blog — PlanetScale
博客园 - 司徒正美
Apple Machine Learning Research
Apple Machine Learning Research
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
博客园 - 三生石上(FineUI控件)
S
Security @ Cisco Blogs
Cloudbric
Cloudbric
E
Exploit-DB.com RSS Feed
Attack and Defense Labs
Attack and Defense Labs

博客园 - lazyman

android uses-permission 配置详解 test ASP.NET课程(一) 基础篇 Http中Get和Post的区别(摘自http://henry2008.teeta.com/blog/data/58260.html) 视频接口基础知识 c与c#数据类型对应关系 计算机文化基础模拟练习系统的设想 Windows Management Instrumentation服务关闭引发程序错误 TextBox中换行方法 - lazyman - 博客园 asp.net访问access数据库的问题 测试用例 vc常用快捷键 从XML文件自动加载下拉列表框 - lazyman - 博客园 利用WebClient实现自动添写、提交表单 昨天写了利用时间序列搜索方法预测股票价格程序 将字符串型转换成datetime类型,字符串可以为各国语言 迎来今年炎热的开始 这个问题让我疯掉!用oledbcommand执行一个插入一条记录的程序,到现在也没有解决! 上午写了一个自动提取网页源文件的程序
接着昨天的,一个分析网页源代码提取股票数据的程序 - lazyman - 博客园
lazyman · 2005-08-11 · via 博客园 - lazyman

主要的就是字符串处理:

        private void AnsCode(string url)
        
{
            
string date="";
            
string open="";
            
string high="";
            
string low="";
            
string close="";
            
string transA="";
            
string transB="";

            
string str=url;

            
string s1="",s2="",s3="",s4="";
            
int pos1=0,pos2=0,pos3=0,pos4=0;
            
int flag=0;
            
while((pos1=str.IndexOf("<td align=middle>"))!=-1)
            
{
                pos1
+=17;
                str
=str.Remove(0,pos1);
                pos2
=str.IndexOf("</td>");
                s1
=str.Substring(0,pos2);
                
if(flag==0)
                
{
                    date
=s1;
                    
//MessageBox.Show(date);
                    flag++;
                }

                
else if(flag==4)
                
{
                    close
=s1;
                    flag
++;
                    pos3
=str.IndexOf("<td align=right>");
                    pos3
+=16;
                    str
=str.Remove(0,pos3);
                    pos4
=str.IndexOf("</td>");
                    s1
=str.Substring(0,pos4);
                    transA
=s1;
                    flag
++;
                    pos3
=str.IndexOf("<td align=right>");
                    pos3
+=16;
                    str
=str.Remove(0,pos3);
                    pos4
=str.IndexOf("</td>");
                    s1
=str.Substring(0,pos4);
                    transB
=s1;
                    flag
++;
                }

                
else if(flag==1)
                
{
                    open
=s1;
                    flag
++;
                }

                
else if(flag==2)
                
{
                    high
=s1;
                    flag
++;
                }

                
else if(flag==3)
                
{
                    low
=s1;
                    flag
++;
                }

                
if(flag==7)
                
{
                    
//处理close字符串
                    int t1=close.IndexOf("<b>");
                    t1
+=3;
                    close
=close.Remove(0,t1);
                    
int t2=close.IndexOf("</b>");
                    close
=close.Remove(t2,4);

                    flag
=0;
                    
//数据在列表中显示
                    ListViewItem lv=new ListViewItem();
                    
//MessageBox.Show(date);
                    lv.SubItems.Clear();
                    lv.SubItems[
0].Text=date;
                    lv.SubItems.Add(open);
                    lv.SubItems.Add(high);
                    lv.SubItems.Add(low);
                    lv.SubItems.Add(close);
                    lv.SubItems.Add(transA);
                    lv.SubItems.Add(transB);
                    listView1.Items.Add(lv);
                }

            }

            MessageBox.Show(
"采集完成");
        }

那个url是网页的源码