// inserting into a string
#include <iostream>
#include <string> int main ()
{
std::string str="to be question";
std::string str2="the ";
std::string str3="or not to be";
std::string::iterator it; // used in the same order as described above:
str.insert(,str2); // to be (the )question
str.insert(,str3,,); // to be (not )the question
str.insert(,"that is cool",); // to be not (that is )the question
str.insert(,"to be "); // to be not (to be )that is the question
str.insert(,,':'); // to be not to be(:) that is the question
it = str.insert(str.begin()+,','); // to be(,) not to be: that is the question
str.insert (str.end(),,'.'); // to be, not to be: that is the question(...)
str.insert (it+,str3.begin(),str3.begin()+); // (or ) std::cout << str << '\n';
return ;
}

string的 insert()

string的 insert的更多相关文章

  1. string中Insert与Format效率对比、String与List中Contains与IndexOf的效率对比

    关于string的效率,众所周知的恐怕是“+”和StringBuilder了,这些本文就不在赘述了.关于本文,请先回答以下问题(假设都是基于多次循环反复调用的情况下):1.使用Insert与Forma ...

  2. C++ string类insert用法总结

    body, table{font-family: 微软雅黑; font-size: 13.5pt} table{border-collapse: collapse; border: solid gra ...

  3. 注意string的insert函数的几种形式

    string (1) string& insert (size_t pos, const string& str); substring (2) string& insert ...

  4. c++-string类--insert函数

    string &insert(int p0, const char *s);--在p0位置插入字符串s string &insert(int p0, const char *s, in ...

  5. 简例 一次执行多条mysql insert语句

    package com.demo.kafka;import java.sql.Connection;import java.sql.DriverManager;import java.sql.Prep ...

  6. c#之Insert字符串的三种写法

    1.Format Format(String, Object) 将指定字符串中的一个或多个格式项替换为指定对象的字符串表示形式. ex1:简单示例怎么应用 private void btnTest_C ...

  7. java转换unicode,筛选文件中的insert语句并把日期给转换为可以直接在数据库执行的语句

    package com; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.File; impo ...

  8. string.Format , object[] args 使用

    string sql = "insert into TableA values('{0}','{1}','{2}',GetDate(),'{3}' "; sql = string. ...

  9. 从源代码的角度聊聊java中StringBuffer、StringBuilder、String中的字符串拼接

    长久以来,我们被教导字符串的连接最好用StringBuffer.StringBuilder,但是我们却不知道这两者之间的区别.跟字符串相关的一些方法中总是有CharSequence.StringBuf ...

随机推荐

  1. 搭建sqli靶场

    前言: sqli是一个印度程序员编写的,用来学习sql注入的一个游戏教程 sqli这个靶场对php7.0是不兼容的(因为一些函数在php7中被删除了),所以搭建的时候要下载php5,如果你的系统要下载 ...

  2. Net上传文件

    Net上传文件 最近工作内容涉及到一点前端的内容,把学习到的内容记录下来,在今后的开发过程中,不要犯错.本篇只针对一些刚入职的小白及前端开发人员,大牛请绕道!~ 刚开始我们先不讲上传文件的防范问题,先 ...

  3. vue报错:Component template should contain exactly one root element. If you are using v-if on multiple elements, use v-else-if to chain them instead.

    在.vue文件中引入了 element-ui 的 table 和 pagination 组件后,报错:Component template should contain exactly one roo ...

  4. 日常工作问题解决:rhel7下配置多路径设备

    目录 1.情景描述 2.安装多路径软件 2.1 安装多路径 2.2检查安装情况 2.3 重启系统 2.4 将多路径软件添加至内核模块 2.5 检查内核添加情况 2.6 启动multipath服务 2. ...

  5. poj2185(kmp算法next数组求最小循环节,思维)

    题目链接:https://vjudge.net/problem/POJ-2185 题意:给定由大写字母组成的r×c矩阵,求最小子矩阵使得该子矩阵能组成这个大矩阵,但并不要求小矩阵刚好组成大矩阵,即边界 ...

  6. Windows Terminal Preview v0.7 Release

    Windows Terminal Preview v0.7 Release The following key bindings are included by default within this ...

  7. 正则与re模块

    一.正则表达式 在线测试工具 http://tool.chinaz.com/regex/ 1.字符组 ​ 在同一个位置可能出现的各种字符组成一个字符组,在正则表达中用[ ]表示 ​ 一个正则就是一条匹 ...

  8. C#xml泛型序列化

    using System; using System.Collections.Generic; using System.IO; using System.Text; using System.Web ...

  9. ASP.NET Core本身已经集成了一个轻量级的IOC容器

    1.services.AddTransient<IApplicationService,ApplicationService>//服务在每次请求时被创建,它最好被用于轻量级无状态服务(如我 ...

  10. 定时任务FluentScheduler

    1.Nuget 安装包 2.创建3个不同的任务 public class MyJob : IJob { void IJob.Execute() { Trace.WriteLine("现在时间 ...