vscode代碼片段,模版-h
自用
{
// "Header File Template": {
// "prefix": "hhhh", //"headerTemplate",
// "body": [
// "#ifndef ${1:HEADER_NAME}_H",
// "#define ${1:HEADER_NAME}_H",
// "#include <iostream>",
// "#include <string>",
// "using namespace std;",
// "",
// "#endif // ${1:HEADER_NAME}_H"
// ],
// "description": "A template for creating a C++ header file"
// }
"Header File Template": {
"prefix": "hhhh", //"headerTemplate",
"body": [
"#ifndef ${TM_FILENAME_BASE/[^\\w]/_/g}_H", //不能做到全大寫 全大寫是規范性建議 倒是不會報錯, 手動輸入全大寫可以用上面那個
"#define ${TM_FILENAME_BASE/[^\\w]/_/g}_H", ///[^\\w]/_/g 將文件名中的非字母數字字符替換為下劃線 _
"#include <iostream>",
"#include <string>",
"using namespace std;",
"",
"#endif // ${TM_FILENAME_BASE/[^\\w]/_/g}_H"
],
"description": "A template for creating a C++ header file"
}
}