Qt通用方法及類庫6

2021-10-05 05:40:23 字數 2353 閱讀 4881

//判斷是否是ip位址

static

bool

isip

(const qstring &ip)

;//判斷是否是mac位址

static

bool

ismac

(const qstring &mac)

;//判斷是否是合法的**號碼

static

bool

istel

(const qstring &tel)

;//判斷是否是合法的郵箱位址

static

bool

isemail

(const qstring &email)

;//16進製制字串轉10進製

static

intstrhextodecimal

(const qstring &strhex)

;//10進製字串轉10進製

static

intstrdecimaltodecimal

(const qstring &strdecimal)

;//2進製字串轉10進製

static

intstrbintodecimal

(const qstring &strbin)

;//16進製制字串轉2進製字串

static qstring strhextostrbin

(const qstring &strhex)

;//10進製轉2進製字串乙個位元組

static qstring decimaltostrbin1

(int decimal)

;//10進製轉2進製字串兩個位元組

static qstring decimaltostrbin2

(int decimal)

;//10進製轉16進製制字串,補零.

static qstring decimaltostrhex

(int decimal)

;

bool quihelper::

isip

(const qstring &ip)

(2[0-4]\\d|25[0-5]|[01]?\\d\\d?)");

return regexp.

exactmatch

(ip);}

bool quihelper::

ismac

(const qstring &mac)

(-[a-f0-9])$");

return regexp.

exactmatch

(mac);}

bool quihelper::

istel

(const qstring &tel)if(

!tel.

startswith

("13")&&

!tel.

startswith

("14")&&

!tel.

startswith

("15")&&

!tel.

startswith

("18"))

return

true;}

bool quihelper::

isemail

(const qstring &email)

return

true;}

int quihelper::

strhextodecimal

(const qstring &strhex)

int quihelper::

strdecimaltodecimal

(const qstring &strdecimal)

int quihelper::

strbintodecimal

(const qstring &strbin)

qstring quihelper::

strhextostrbin

(const qstring &strhex)

}return bin;

}qstring quihelper::

decimaltostrbin1

(int decimal)

}return bin;

}qstring quihelper::

decimaltostrbin2

(int decimal)

}return bin;

}qstring quihelper::

decimaltostrhex

(int decimal)

return temp;

}

Qt通用方法及類庫13

設定按鈕樣式 static qstring setpushbuttonqss qpushbutton btn,按鈕物件 int radius 5,圓角半徑 int padding 8,間距 const qstring normalcolor 34495e 正常顏色 const qstring nor...

Qt通用方法及類庫11

static bool iplive const qstring ip,int port,int timeout 1000 獲取網頁所有源 static qstring gethtml const qstring url 獲取本機公網ip位址 static qstring getnetip cons...

Qt通用方法及類庫8

異或加密演算法 static qstring getxorencryptdecrypt const qstring str,char key 異或校驗 static uchar getorcode const qbytearray data 計算校驗碼 static uchar getcheckco...