⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 capmain.cpp

📁 本文件是<精通QT4编程>的配套源代码
💻 CPP
字号:
#include <iostream>#include <QtCore>using namespace std;int main(int argc, char *argv[]){    QCoreApplication app(argc, argv);    int pos;    int index;    QRegExp rx("(http://(?:[a-z0-9_\\.])+(?:com|cn|net|org|gov|mil)"    	"|(ftp://(?:[a-z0-9_\\.])+(?:com|cn|net|org|gov|mil))"    	"|(mailto:(?:[a-z0-9_\\.])+@(?:[a-z0-9\\.])+(?:com|cn|net|org|gov|mil)))");    if(!rx.isValid())    {    	cout << qPrintable(rx.errorString());    	return -1;    }        QFile file("index.html");    if (!file.open(QIODevice::ReadOnly | QIODevice::Text))         return -1;    QTextStream in(&file);    while (!in.atEnd()) {        QString str = in.readLine();	 	pos = 0;	 	while ((pos = rx.indexIn(str, pos)) != -1) {	 		for(index = 0; index <3; index++) {	 			if(!rx.cap(index).isEmpty())						cout << qPrintable(rx.cap(index)) << endl;	 		}	     	pos += rx.matchedLength();	 	}    }     return 0;}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -