// 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. 游戏协议模拟测试工具(TcpEngine)使用简介

    功能介绍 在有的网络开发需要走二进制流协议场景,比如网络游戏开发,在开发阶段,前端和后端协商好协议后就分别开发.在开发写代码的时候,有时需要对端发送一条完整的协议过来触发一下自己的代码,进行单步调试或 ...

  2. JS获取URL参数中文乱码解决

    var param = window.location.search; var paramArray = parseParams(param); var selectV = decodeURI(par ...

  3. 高阶函数 filter map reduce

    const app=new Vue({ el:'#app', data:{ books:[{ id:1, name:"算法导论", data: '2006-1', price:39 ...

  4. [LuoguP1155]双栈排序_二分图_bfs

    双栈排序 题目链接:https://www.luogu.org/problem/P1155 数据范围:略. 题解: 神仙题. 就第一步就够劝退了. 这个二分图非常不容易,首先只有两个栈,不是属于一个就 ...

  5. vue element-ui typescript tree报错 === Property 'getCheckedNodes' does not exist on type 'Element | Element[] | Vue | Vue[]'.

    import { Tree } from 'element-ui' const ref = <Tree>this.$refs.tree ref.getCheckedNodes()

  6. 使用 netkeeper 创翼电脑开 WiFi 方法(12)

    学校的宽带使用"netkeeper"联网,但是电脑依然可以开启WiFi,以下是方法: 1. Win10用户请看 2. Win7用户请看 Win7无法在"任务管理器&quo ...

  7. centos 7.2安装git2.x版本

    前言 今天在我的centos7.2开发环境安装git2.x时候遇到了各种问题,还好一一解决,为方便大家,这里列出遇到的问题和解决办法,yum默认安装的git1.8版本的,公司git服务器在window ...

  8. HTML 是什么?

    HTML 指的是超文本标记语言(英语:HyperText Markup Language),是用来描述网页的一种语言. HTML 不是一种编程语言,而是一种标记语言,它有一套标记标签 . HTML 使 ...

  9. LeetCode_#1_两数之和 Two Sum_C++题解

    1. 两数之和 Two Sum 题目描述 Given an array of integers, return indices of the two numbers such that they ad ...

  10. python学习-11 运算符2

    布尔值 1.真 true 假false name = 'abc' c = 'c' in name print(c) 运算结果: True Process finished with exit code ...