main.cpp
来自「在C++标准库<string>中」· C++ 代码 · 共 47 行
CPP
47 行
/**
* @file main.cpp
* @brief StringTrim.h使用示例文件
* @author Hao Liming
* @date 2008-11-6 13:01:50
* @Version 0.1
* <pre><b>copyright: CASCO</b></pre>
* <pre><b>email: </b>haoliming@casco.com.cn</pre>
* <pre><b>company: </b>http://www.casco.com.cn</pre>
* <pre><b>All rights reserved.</b></pre>
* <pre><b>modification:</b></pre>
* <pre></pre>
*/
#include "StringTrim.h"
#include "string"
#include <iostream>
#include <windows.h>
int main()
{
std::string test = " Hello World! ";
std::cout << "转换前test字符串大小为" << test.length()<< std::endl;
/** @brief 去掉首尾空格*/
CASCO::trim(test);
std::cout << "转换后test字符串大小为" << test<< std::endl;
/** @brief 整个字符串空格*/
/** @brief 去掉子串空格*/
std::string test1 = " a";
CASCO::beginEndTrim(test1,1,1);
std::cout<<"88";
std::cout<<test1<<"99"<<std::endl;
/** @brief 去掉子串空格*/
std::string test2 = " aaa fa a";
CASCO::startSizTrim(test2,0,11);
std::cout<<"88";
std::cout<<test2<<"99"<<std::endl;
return 0;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?