發幾個c 常用小工具的函式(續)

2021-05-27 20:23:18 字數 1428 閱讀 7359

筆記一直再做專案,隨時都會用到一些函式和方法,現在屬於一種原始積累狀態,將來用到的時候就隨便拿來用。省時又省力。。後續還會很多這樣的方法。大家也可以去找找。
//取當前日期

string getcurdate()

//取得當前時間

string getcurtime()

//int型轉string 型

string inttostring(int value)

//將字串處理為小寫。

void tolower(string &strtmp)

return;

}///根據分隔標記flag將字串放入。。。。

int getitem(string &msg , char flag, vector&line)

if (msg.length() == 0)

char *tmpmsg = &msg[0];

int begin = 0;

int end = 0;

string tmp;

for (unsigned int i = 0; i < msg.length(); i ++)

else

if ((end-begin)> 0)

else

begin = end+1;

line.push_back(tmp);

}if ((msg.length()-begin)> 0)

}catch(...)

return 0;

}輸出vector的內容。

void dispvector(const vector&vectmp)

for (unsigned int i = 0 ; i < vectmp.size(); i++)

return ;

}返回num後的字串

string laststr(string &from, int num)

else

}string leftfullchar(string &from, int count, char flag)

int fullcount = (int)from.length() - count;

string strtmp(fullcount, flag);

strtmp += from;

return strtmp;

}string rightfullchar(string &from, int count, char flag)

int fullcount = (int)from.length() - count;

string strtmp(fullcount, flag);

return from+strtmp;

}

MFC常用小工具函式

1 判斷檔案是否存在 bool isfileexist cstring sfilename return true 2 判斷目錄是否存在 bool clib global ispathexist const cstring spathname findclose hfind return rvalu...

幾個好用的小工具

記錄幾個常用的軟體 描述 名稱位址 md檔案編輯器 typora kindle格式轉換 calibre 資源管理 像瀏覽器那樣開啟資管管理器 clover 截圖工具 faststone capture 錄屏工具 ocam 修改hosts switchhosts windows上最強大的虛擬桌面工具 ...

C 演算法常用小工具之 Pair

pair 就是類似乙個小結構體,他將兩個元素 在一起成為乙個元素,經常用於兩個變數 有一定 bond 的情況,例如 x,y座標 姓名和成績 性別和身高等等 pair 的宣告初始化以及呼叫 pair的宣告 需要新增utility標頭檔案,記不住的話也可以用map標頭檔案 pair有兩個引數,first...