当前位置: 首页 > news >正文

网站关键词密度太高怎么处理wordpress添加主题设置页面

网站关键词密度太高怎么处理,wordpress添加主题设置页面,重庆建网站要多少钱,网店代运营收费多少钱文章目录 1.判断1.1.equals1.2.all1.3.starts_with1.4.ends_with1.5.contains 2.大小写转换3.字符串删除4.字符串替换5.字符串查找6.字符串修剪7.字符串分割8.字符串合并9.总结 1.判断 判别式函数和分类函数大多数都是以is_开头#xff0c;这些函数如下#xff1a; 判别式函… 文章目录 1.判断1.1.equals1.2.all1.3.starts_with1.4.ends_with1.5.contains 2.大小写转换3.字符串删除4.字符串替换5.字符串查找6.字符串修剪7.字符串分割8.字符串合并9.总结 1.判断 判别式函数和分类函数大多数都是以is_开头这些函数如下 判别式函数包括is_equal(等于)、is_less(小于)、is_not_greater不大于、lexicographical_compare(根据顺序检测一个字符串是否小于另一个)、starts_with(检测一个字符串是否是另一个的前缀)、ends_with(检测一个字符串是否是另一个的后缀)、contains(包含)、equals(相等)、all(检测一个字符串中的所有元素是否满足指定的判别式)。 分类函数is_space、is_alnum(字符和数字)、is_alpha(字母)、is_cntrl(控制符)、is_digit(十进制)、is_graph(图形字符)、is_lower(小写)、is_upper(大写)、is_print(可打印字符)、is_punct(标点符号)、is_xdigit(十六进制)、is_any_of(是否是序列中的任意字符)、if_from_range(是否位于指定区间包括两头) 1.1.equals #include boost/algorithm/string.hpp assert(boost::equals(boost, boost)); assert(!boost::equals(boost, BOOST)); assert(boost::iequals(boost, BOOST));1.2.all all , 如果它的所有元素满足一个给定的通过判断式描述的条件则这个条件式成立。 assert(boost::all(\x20\t\n\r, boost::is_space())); assert(boost::all(\x20\t\n\r, boost::is_classified(std::ctype_base::space))); assert(boost::all(\x20\t\n\r, boost::is_any_of(\x20\t\n\r))); assert(boost::all(abcde, boost::is_from_range(a, e))); assert(boost::all(abcde, boost::is_from_range(a, z))); assert(!boost::all(abcde, boost::is_from_range(b, c))); assert(boost::all(abc __ de, boost::is_from_range(a, z) || boost::is_space() || boost::is_any_of(_)));1.3.starts_with assert(boost::starts_with(boost_python-vc100-mt-1_49.dll, boost)); assert(!boost::starts_with(boost_python-vc100-mt-1_49.dll, BOOST)); assert(boost::istarts_with(boost_python-vc71-mt-1_33.dll, BOOST));1.4.ends_with assert(boost::ends_with(boost_python-vc100-mt-1_49.dll, .dll)); assert(!boost::ends_with(boost_python-vc100-mt-1_49.dll, .DLL)); assert(boost::iends_with(boost_python-vc100-mt-1_49.dll, .DLL));1.5.contains assert(boost::contains(boost_python-vc100-mt-1_49.dll, python)); assert(!boost::contains(boost_python-vc100-mt-1_49.dll, PYTHON)); assert(boost::icontains(boost_python-vc100-mt-1_49.dll, PYTHON));is_space: 字符是否为空格 is_alnum: 字符是否为字母和数字字符 is_alpha: 字符是否为字母 is_cntrl: 字符是否为控制字符 is_digit: 字符是否为十进制数字 is_graph: 字符是否为图形字符 is_lower: 字符是否为小写字符 is_print: 字符是否为可打印字符 is_punct: 字符是否为标点符号字符 is_upper: 字符是否为大写字符 is_xdigit: 字符是否为十六进制数字 is_any_of: 字符是否是参数字符序列中的任意字符 is_from_range 字符是否位于指定区间内即from ch to 2.大小写转换 主要有如下API: to_lower_copy将原来字符串转换为小写字符串并返回新的字符串原来字符串不改变。 to_upper_copy将原来字符串转换为大写字符串并返回新的字符串原来字符串不改变。 to_lower将原来字符串转换为小写字符串原来字符串改变。 to_upper将原来字符串转换为大写字符串原来字符串改变。 3.字符串删除 boost库提供了众多的字符串删除函数并且提供了很多版本供使用例如以i开头的用来区分大小写敏感、以_copy结尾的以不改变原来的字符串等以满足使用者不同的需求。 erase_first:删除在字符串中第一个出现的字符串。 erase_last:删除在字符串中最后一个出现的字符串。 erase_nth:删除在字符串中第n个出现的字符串。 erase_all:删除在字符串中所有出现的字符串。 erase_head:删除输入的开头。 erase_tail:删除输入的结尾。 #include iostream #include boost/algorithm/string.hppint main() {std::string tmpStrErase Hello!Hello!Im ISmileLi!Hello!Hello!Im ISmileLi!;std::cout tmpStrErase: tmpStrErase std::endl;boost::algorithm::erase_first(tmpStrErase, Hello);std::cout tmpStrErase: tmpStrErase std::endl;std::string tmpEraseLastStr boost::algorithm::erase_last_copy(tmpStrErase, Hello);std::cout tmpStrErase: tmpStrErase std::endl;std::cout tmpEraseLastStr: tmpEraseLastStr std::endl;boost::algorithm::erase_nth(tmpStrErase, Hello, 2);std::cout tmpStrErase: tmpStrErase std::endl;boost::algorithm::erase_all(tmpStrErase, Hello);std::cout tmpStrErase: tmpStrErase std::endl;std::string tmpEraseHeadCopyStr boost::algorithm::erase_head_copy(tmpStrErase, 5);std::cout tmpStrErase: tmpStrErase std::endl;std::cout tmpEraseHeadCopyStr: tmpEraseHeadCopyStr std::endl;std::cout Hello World!\n;getchar(); }4.字符串替换 boost库提供了众多的字符串替换函数并且提供了很多版本供使用例如以i开头的用来区分大小写敏感、以_copy结尾的以不改变原来的字符串等以满足使用者不同的需求。 boost库提供的替换函数如下 replace_first:替换在字符串中第一个出现的字符串。 replace_last:替换在字符串中最后一个出现的字符串。 replace_nth:替换在字符串中第n个出现的字符串。 replace_all:替换在字符串中所有出现的字符串。 replace_head:替换输入的开头。 replace_tail:替换输入的结尾。 #include iostream #include boost/algorithm/string.hppint main() {std::cout -------------------boost库字符串替换------------------ std::endl;std::string tmpStrReplace HELLO!HELLO!Im ISmileLi!HELLO!HELLO!Im ISmileLi!;std::cout -------------------打印原来字符串的值------------------ std::endl;std::cout tmpStrReplace: tmpStrReplace std::endl;boost::algorithm::replace_first(tmpStrReplace, HELLO, hello);std::cout -------------------替换第一个字符串后------------------ std::endl;std::cout tmpStrReplace: tmpStrReplace std::endl;std::string tmpReplaceLastStr boost::algorithm::replace_last_copy(tmpStrReplace, HELLO, hello);std::cout -------------------替换最后一个字符串后------------------ std::endl;std::cout tmpStrReplace: tmpStrReplace std::endl;std::cout tmpReplaceLastStr: tmpReplaceLastStr std::endl;boost::algorithm::replace_nth(tmpStrReplace, HELLO, 2, hello);std::cout -------------------替换第2个字符串后------------------ std::endl;std::cout tmpStrReplace: tmpStrReplace std::endl;boost::algorithm::replace_all(tmpStrReplace, HELLO, hello);std::cout -------------------替换所有出现的字符串后------------------ std::endl;std::cout tmpStrReplace: tmpStrReplace std::endl;std::string tmpReplaceTailCopyStr boost::algorithm::replace_tail_copy(tmpStrReplace, 5, hello);std::cout -------------------替换结尾出现的几个字符串后------------------ std::endl;std::cout tmpStrReplace: tmpStrReplace std::endl;std::cout tmpReplaceHeadCopyStr: tmpReplaceTailCopyStr std::endl;std::cout Hello World!\n;getchar(); }5.字符串查找 boost库提供了众多的字符串查找函数并且提供了很多版本供使用例如以i开头的用来区分大小写敏感的以不改变原来的字符串等没有_copy版本以满足使用者不同的需求。 boost库提供的查找函数如下 find_first:查找在字符串中第一个出现的字符串。 find_last:查找在字符串中最后一个出现的字符串。 find_nth:查找在字符串中第n个出现的字符串。 find_head:查找输入的开头第N个子串。 find_tail:查找输入的结尾第N个子串。 #include iostream #include boost/algorithm/string.hppint main() {std::cout -------------------boost库字符串查找------------------ std::endl;std::string tmpStrFind HELLO!HELLO!Im ISmileLi!HELLO!HELLO!Im ISmileLi!;std::cout -------------------打印原来字符串的值------------------ std::endl;std::cout tmpStrFind: tmpStrFind std::endl;boost::iterator_rangestd::string::iterator rIter boost::algorithm::find_first(tmpStrFind, ISmileLi);std::cout 查找第一个字符串出现的位置: rIter.begin() - tmpStrFind.begin() std::endl;//迭代器计算位置rIter boost::algorithm::find_last(tmpStrFind, ISmileLi);std::cout 查找最后一个字符串ISmileLi出现的位置: rIter.begin() - tmpStrFind.begin() std::endl;rIter boost::algorithm::find_nth(tmpStrFind, HELLO, 3);std::cout 查找第3个字符串HELLO出现的位置: rIter.begin() - tmpStrFind.begin() std::endl;rIter boost::algorithm::find_head(tmpStrFind, 3);std::cout 查找开头3个字符串出现的位置: rIter.begin() - tmpStrFind.begin() std::endl;std::cout rIter: rIter std::endl;rIter boost::algorithm::find_tail(tmpStrFind, 3);std::cout 查找结尾3个字符串出现的位置: rIter.begin() - tmpStrFind.begin() std::endl;std::cout rIter: rIter std::endl;std::cout Hello World!\n;getchar(); }6.字符串修剪 boost库提供了众多的字符串修剪函数并且提供了很多版本供使用例如以_copy、_if、_copy_if结尾的版本等以满足使用者不同的需求。主要函数有trim_left、trim_right、trim这三种方式以及它们的变种版本。 #include iostream #include boost/algorithm/string.hppint main() {std::cout -------------------boost库字符串修剪------------------ std::endl;std::string tmpTrimSr ...88HELLO!HELLO!Im ISmileLi!HELLO!HELLO!Im ISmileLi!666... ;std::cout -------------------打印原来字符串的值------------------ std::endl;std::cout tmpTrimSr: tmpTrimSr std::endl;std::cout -------------------删除字符串空格------------------ std::endl;std::string trimSpace boost::algorithm::trim_copy(tmpTrimSr);std::cout 不改变原字符串 trimSpace std::endl;std::cout 改变原字符串,删除左边 std::endl;boost::trim_left(tmpTrimSr);std::cout tmpTrimSr std::endl;std::cout 改变原字符串,删除右边 std::endl;boost::trim_right(tmpTrimSr);std::cout tmpTrimSr std::endl;std::cout -------------------使用判别式删除字符串两端的空格、标点、数字------------------ std::endl;std::cout boost::trim_copy_if(tmpTrimSr, boost::is_space() || boost::is_punct() || boost::is_digit()) std::endl;std::cout Hello World!\n;getchar(); }7.字符串分割 boost库提供了一个分割函数split()可以根据某种特定的字符或者策略把分割后的字符保存到指定的容器中。 #include iostream #include vector #include boost/algorithm/string.hppint main() {std::cout -------------------boost库字符串分割------------------ std::endl;std::string tmpStrFind HELLO!HELLO!Im ISmileLi!HELLO!HELLO!Im ISmileLi!;std::cout 原字符串 tmpStrFind std::endl;std::vectorstd::string splitVector;// 使用标点符号切割字符串boost::algorithm::split(splitVector, tmpStrFind, boost::algorithm::is_punct());std::cout -----------打印切割后的字符串---------- std::endl;for (int i 0; i splitVector.size(); i){std::cout splitVector.at(i) std::endl;}// 常规用法std::string str Hello,World,How,Are,You;std::vectorstd::string result;boost::split(result, str, boost::is_any_of(,));std::cout Hello World!\n;getchar(); }8.字符串合并 boost库提供了一个合并函数join()它可以把存储在容器中的字符串通过指定的分隔符连接在一起。 #include iostream #include vector #include boost/algorithm/string.hppint main() {std::cout -------------------boost库字符串合并------------------ std::endl;std::string tmpStrFind HELLO!HELLO!Im ISmileLi!HELLO!HELLO!Im ISmileLi!;std::cout 原字符串 tmpStrFind std::endl;std::vectorstd::string splitVector;// 使用标点符号切割字符串boost::algorithm::split(splitVector, tmpStrFind, boost::algorithm::is_punct());std::cout -----------打印切割后的字符串---------- std::endl;for (int i 0; i splitVector.size(); i){std::cout splitVector.at(i) std::endl;}std::cout -----------使用合并函数join并打印合并后的字符串---------- std::endl;std::cout boost::algorithm::join(splitVector, ) std::endl;//lambda表达式std::string tempJoinIfStr boost::algorithm::join_if(splitVector, $$, [](std::string tmpStr) {return boost::algorithm::contains(tmpStr, I);});std::cout tempJoinIfStr: tempJoinIfStr std::endl;std::cout Hello World!\n;getchar(); }9.总结 字符串的常用操作软件工程师使用起来还是非常方便快捷。
http://www.dnsts.com.cn/news/245253.html

相关文章:

  • 网站开发协同wordpress缓存到内存
  • 包头网站建设制作黄山网站设计公司
  • 网站建设能解决哪些问题南京网络程序开发公司
  • 网站备案拍照幕布安徽建设工程信息中标
  • 什么是网站设计种类做外贸一般看什么网站
  • 天河区门户网站教育局板块手机报价大全
  • 渭南市住房和城乡建设部网站呼叫中心系统软件
  • 亚马逊电商平台官网网站做301对优化有影响
  • 公司网站打不开怎么办佛山网站优化美姿姿seo
  • 高端网站建设价钱网站改版需要注意
  • 珠海找工作哪个网站好关键词排名优化公司哪家强
  • 个人可以注册网站吗网络营销的建议方案
  • 济南高新区网站建设电器企业网站建设
  • 桂城网站制作公司国外采购平台有哪些
  • 清润邯郸网站网站开发主要做哪些
  • 微信公众号做头图的网站长沙人才网官网入口
  • 电子工程专辑泰安网站seo推广
  • 菜市场做建筑设计图库的网站设计app网站的优点
  • 网做英文网站河池网站seo
  • 六盘水网站建设求职简历网站建设成都公司哪家好
  • 如何在淘宝上接单网站建设平面设计免费软件
  • 网站在哪里找经销商网
  • 公司的网站开发费计入什么科目网站建设公司特色
  • 为什么自己做的网站uc打不开重庆便民服务网站APP
  • 江宁城乡建设局网站莱芜金点子信息港招聘
  • 专业网站建设最便宜哈尔滨网站建设推广服务
  • 沈阳专业网站制作国外有哪些网站可以做电商
  • 国外网站排名前十wordpress首页自定义缩略图大小
  • 民宿网站开发方案wordpress点击打印网页
  • 网站定制开发费用多少体检中心网站建设方案