#include <iostream>
#include "include/yaml.h"
#include<fstream>
#include <cstring>
#include <string>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
using namespace std;
/*
用新的字符(字符串)替换旧的字符(字符串)
*/
std::string& replace_all_distinct(std::string& str,const std::string& old_value,const std::string& new_value)
{
for(std::string::size_type pos(0); pos!=std::string::npos; pos+=new_value.length())
{
if((pos=str.find(old_value,pos))!=std::string::npos)
{
str.replace(pos,old_value.length(),new_value);
}
else
{
break;
}
}
return str;
}
/*
作用: 以字符(子字符串)delim 分割字符串s
参数:delim 子字符,如'\n'
s 从文件中读出来的字符串
*/
std::vector<std::string> StringSplit2(const std::string& s, const std::string& delim)
{
std::vector<std::string> elems;
size_t pos = 0;
//字符串长度
size_t len = s.length();
//字符
c++ yaml文件读写与字符串处理
最新推荐文章于 2024-07-26 11:48:49 发布

最低0.47元/天 解锁文章
1633

被折叠的 条评论
为什么被折叠?



