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

怎么用java做html5网站吗/佛山快速排名

怎么用java做html5网站吗,佛山快速排名,凡科h5制作,wordpress数据库显示图片目录 1.push_back() 尾插字符 2.append() 尾插字符串 3.operator 4.assign 覆盖 5.insert() 指定位置插入 6.erase() 删除 7.replace() 替换 8.swap() 交换 9.pop_back() 尾删 1.push_back() 尾插字符 void push_back (char c) string s("i miss gjj"); s…

目录

1.push_back() 尾插字符

2.append() 尾插字符串

3.operator+=

4.assign 覆盖

5.insert() 指定位置插入

6.erase() 删除

7.replace() 替换

8.swap() 交换

9.pop_back() 尾删


1.push_back() 尾插字符

void push_back (char c)

string s("i miss gjj");
s.push_back('!');
cout << s << endl;//i miss gjj!

2.append() 尾插字符串

1.string& append (const string& str) 尾插字符串

string s("i miss gjj");
s.append(",i love gjj");
cout << s << endl;//i miss gjj,i love gjj

2.string& appned (const string& str, size_t subpos, size_t sublen) 尾插字符串的第subpos位置开始的sublen字符(sublenda≥剩余字符串长度,则尾插剩余所有字符)

string s("i miss gjj");
s.append("040525", 2, 4);//i miss gjj0525

3.string& append (char* s) 尾插指针指向的字符串 

string s("i miss gjj");
char p[] = "!!!";
s.append(p);   
cout << s << endl;//i miss gjj!!!

4.string& append (char* s, size_t n) 尾插指针指向字符串的前n个字符

string s("i miss gjj");
char p[] = "5257";
s.append(p, 2);   
cout << s << endl;//i miss gjj52

5.string& append (char c, size_t n) 尾插n个字符c

string s("i miss gjj");
s.append(10, '!');
cout << s << endl;//i miss gjj!!!!!!!!!!

6.template <class InputIterator>

string& append (InputIterator first, InputIterator last) 尾插迭代器指向范围的字符串

string s1("i miss gjj");
string s2("i miss gjj");
string s(" 5257 ");
s1.append(s.begin(), s.end());
s2.append(++s.begin(), s.end() - 2);
cout << s1 << endl;//i miss gjj 5257
cout << s2 << endl;//i miss gjj525

3.operator+=

1.string& operator+= (const string& str)

2.string& operator+= (const char* s)

3.string& operator+= (char c)

string s1(" i miss gjj !");
string s2(" gjj miss i !");
s1 += s2;
cout << s1 << endl;// i miss gjj ! gjj miss i !
s1 += "######";
cout << s1 << endl;// i miss gjj ! gjj miss i !######
s1 += '$';
cout << s1 << endl;// i miss gjj ! gjj miss i !######$

4.assign 覆盖

1.string& assign (const string& str) 用对象str数据覆盖现有对象数据

string s1("hello world");
string s2("gjj");
s1.assign(s2);
cout << s1 << endl;//gjj

2.string& assign (const string& str, size_t subpos, size_t sublen) 用对象str的第subpos位置开始的sublen个数据覆盖现有对象数据

string s1("hello world");
string s2("gjj");
s1.assign(s2, 1, 2);
cout << s1 << endl;//jj

3.string& assign (const char* s) 用字符串s覆盖现有对象数据

string s("!!!");
char p[] = "gjj and i";
s.assign(p);
cout << s << endl;//gjj and i

4.string& assign (const char* s, size_t n) 用字符串s的前n个字符覆盖现有对象数据

string s("!!!");
char p[] = "gjj and i 5257";
s.assign(p, 9);
cout << s << endl;//gjj and i

5.string& assign (size_t n, char c) 用n个字符c覆盖现有对象数据

string s("!!!");
s.assign(2, 'j');
cout << s << endl;//jj

6.template <class InputIterator>

string& assign (InputIterator first, InputIterator last) 用迭代器指定范围覆盖现有对象数据

string s1("!!!");
string s2("gjj");
s1.assign(s2.begin(), s2.end());
cout << s1 << endl;//gjj

5.insert() 指定位置插入

1.string& insert (size_t pos, const string& str) 在pos位置前插入对象str数据

string s1("gjj");
string s2("love ");
s1.insert(0, s2);
cout << s1 << endl;//love gjj

2.string& insert (size_t pos, const string& str, size_t subpos, size_t sublen) 在pos位置前插入对象str从subpos位置开始的sublen个数据

string s1("hello");
string s2(" world");
s1.insert(5, s2, 0, 6);
cout << s1 << endl;//hello world

3.string& insert (size_t pos, const char* s) 在pos位置前插入字符串s

string s1("hello");
char p[] = " world";
s1.insert(5, p);
cout << s1 << endl;//hello world

4.string& insert (size_t pos, const char* s, size_t n) 在pos位置前插入字符串s的前n个字符

string s1("hello ");
char p[] = "12345";
s1.insert(6, p, 3);
cout << s1 << endl;//hello 123

5.string& insert (size_t, pos, size_t n, char c) 在pos位置前插入n个字符c

void insert (iterator p, size_t n, char c) 在迭代器p指向位置前插入n个字符c

string s1("hello ");
string s2("hello ");
s1.insert(s1.begin(), 3, '#');
s2.insert(s2.end(), 3, '#');
cout << s1 << endl;//###hello
cout << s2 << endl;//hello ###

6.iterator insert (iterator p, char c) 在迭代器p指向位置插入字符c

string s("hello");
s.insert(s.end(), '!');
cout << s << endl;//hello!

7.template <class InputIterator>

void insert (iterator p, InputItrator first, InputItrator last) 在迭代器p指向的位置插入迭代器first和last指向的范围数据

string s1("hello");
string s2(" world");
s1.insert(s1.end(), s2.begin(), s2.end());
cout << s1 << endl;//hello world

6.erase() 删除

1.string& erase (size_t pos = 0, size_t len = npos) 从pos位置开始删除len个字符(如果不提供参数相当于clear,删除所有数据)

2.iterator erase (iterator p) 删除迭代器p指示的位置

3.iterator erase (iterator first, iterator last) 删除迭代器first与last指示范围之间的数据

string s("hello");
s.erase(2, 10);
cout << s << endl;//hestring s("hello");
s.erase(s.begin());
cout << s << endl;//ellostring s("hello");
s.erase(s.begin(), --s.end());
cout << s << endl;//o

7.replace() 替换

1.string& replace (size_t pos, size_t len, const string& str) 用str数据替换pos位置起的len个字符

string& replace (iterator i1, iterator i2, const string& str) 用str数据替换迭代器i1和i2指示范围数据

string s1("hello world");
string s2("#####");
s1.replace(2, 3, s2);
cout << s1 << endl;//he##### world
s1.replace(2, 3, "$$$$$");
cout << s1 << endl;//he$$$$$## world
s1.replace(s1.begin(), s1.end(), s2);
cout << s1 << endl;//#####

 2.string& replace (size_t pos, size_t len, const string& str, size_t subpos, size_t sublen) 

用str的subpos位置开始的sublen个数据替换pos位置开始的len个数据

string s("hello world");
s.replace(6, 5, "bit", 0, 3);
cout << s << endl;//hello bit

3.string& replace (size_t pos, size_t len, const char* s) 用字符串s替代pos位置开始的len个数据

string& replace (iterator i1, iterator i2, const char* s) 用字符串s替代迭代器i1和i2指向的范围数据

string s("hello world");
char p1[] = "gjj";
char p2[] = "world";
s.replace(6, 5, p1);
cout << s << endl;//hello gjj
s.replace(s.begin() + 6, s.end(), p2);
cout << s << endl;//hello world

4.string& replace (size_t pos, size_t len, const char*s, size_t n) 用字符串s的前n个字符替代pos位置开始的len个数据

string& replace (iterator i1, iterator i2, const char*s, size_t n) 用字符串s的前n个数据替代迭代器i1和i2指向的范围数据

string s("hello world");
char p1[] = "gjj111";
char p2[] = "world222";
s.replace(6, 5, p1, 3);
cout << s << endl;//hello gjj
s.replace(s.begin() + 6, s.end(), p2, 5);
cout << s << endl;//hello world

5.string& replace (size_t pos, size_t len, size_t n, char c) 用n个字符c替换pos位置开始的len个数据

string& replace (iterator i1, iterator i2, size_t n, char c) 用n个字符c替换迭代器i1和i2指示的范围数据

string s("hello world");
s.replace(6, 5, 2, 'j');
cout << s << endl;//hello jj
s.replace(s.begin() + 6, s.end(), 2, 'z');
cout << s << endl;//hello zz

6.template <class InputIterator>

string& replace (iterator i1, iterator i2, InputIterator first, InputIterator last)

用迭代器first和last指示的数据范围替换迭代器i1和i2指示的数据范围

string s1("hello world");
string s2("gjj");
s1.replace(s1.begin() + 6, s1.end(), s2.begin(), s2.end());
cout << s1 << endl;//hello gjj

8.swap() 交换

void swap(string& str) 交换两个对象的数据

string s1("hello world");
string s2("hello gjj");
s1.swap(s2);
cout << s1 << endl;//hello gjj
cout << s2 << endl;//hello world

9.pop_back() 尾删

void pop_back() 删除最后一个字符

string s("hello gjj#");
s.pop_back();
cout << s << endl;//hello gjj

相关文章:

C++中string容器的修改操作

目录 1.push_back() 尾插字符 2.append() 尾插字符串 3.operator 4.assign 覆盖 5.insert() 指定位置插入 6.erase() 删除 7.replace() 替换 8.swap() 交换 9.pop_back() 尾删 1.push_back() 尾插字符 void push_back (char c) string s("i miss gjj"); s…...

Elasticsearch:虚拟形象辅助和对话驱动的语音到 RAG 搜索

作者&#xff1a;来自 Elastic Sunile Manjee 搜索的演变 搜索已经从产生简单结果的简单文本查询发展成为容纳文本、图像、视频和问题等各种格式的复杂系统。 如今的搜索结果通过生成式人工智能、机器学习和交互式聊天功能得到增强&#xff0c;提供更丰富、更动态且与上下文相…...

测试开发工程师(QA)职业到底需要干些什么?part7:硬件测试工程师QA

概述 硬件测试工程师QA主要负责确保硬件产品在设计、制造和交付过程中的质量和性能。主要任务是进行测试、验证和分析硬件系统、组件和设备&#xff0c;以确保其符合规格和质量标准。下面是硬件测试工程师QA在其工作中常涉及的一些方面&#xff1a; 测试计划和策略&#xff1a…...

Python基础:标准库 -- pprint (数据美化输出)

1. pprint 库 官方文档 pprint --- 数据美化输出 — Python 3.12.2 文档 pprint — Data pretty printer — Python 3.12.2 documentation 2. 背景 处理JSON文件或复杂的嵌套数据时&#xff0c;使用普通的 print() 函数可能不足以有效地探索数据或调试应用程序。下面通过一…...

Visual Studio 小更新:改善变量的可见性

在 Visual Studio 2022 17.10 预览版 2 中&#xff0c;我们改善了一些小功能&#xff0c;例如&#xff1a;在调试版本中&#xff0c;变量窗口现已可以显示调用堆栈中任意帧的局部变量。 如需体验此功能&#xff0c;请直接安装最新预览版本&#xff0c;就可以知道是怎么一回事儿…...

C++自主点餐系统

一、 题目 设计一个自助点餐系统&#xff0c;方便顾客自己点餐&#xff0c;并提供对餐厅销售情况的统计和管理功能。 二、 业务流程图 三、 系统功能结构图 四、 类的设计 五、 程序代码与说明 头文件1. SystemMap.h #pragma once #ifndef SYSTEMMAP #define SYSTEMMAP #in…...

jconsole jvisualvm

jconsole 打开方式 命令行输入 jconsole双击想要连接的应用 界面展示 jvisualvm 打开方式 命令行输入 jvisualvm双击想要连接的应用 可以安装插件&#xff0c;比如 Visual GC 直观看到 GC 过程...

python vtkUnstructuredGrid 转 vtkAlgorithmOutput_

在VTK (Vtk.py)中&#xff0c;vtkUnstructuredGrid对象可以通过多种方式转换为vtkAlgorithmOutput_对象。这种转换通常在管道中使用&#xff0c;以将一个算法的输出传递给另一个算法作为其输入。 以下是一个简单的例子&#xff0c;展示如何将vtkUnstructuredGrid对象转换为 v…...

IS-IS路由

概览&#xff1a; Intermediate System-to-Intermediate System&#xff0c;中间系统到中间系统协议 IS-IS--IGP--链路状态协议--AD值&#xff1a;115 IS--中间系统&#xff08;路由器&#xff09; ES--终端系统&#xff08;PC&#xff09; 在早期IS-IS的开发并不是为了IP…...

打造新质生产力,亚信科技2024年如何行稳致远?

引言&#xff1a;不冒进、不激进&#xff0c;稳扎稳打&#xff0c; 一个行业一个行业地深度拓展。 【全球云观察 &#xff5c; 科技热点关注】 基于以往“一巩固、三发展”的多年业务战略&#xff0c;亚信科技正在落实向非通信行业、标准产品、软硬一体产品和国际市场的“四…...

开源博客项目Blog .NET Core源码学习(12:App.Application项目结构分析)

开源博客项目Blog的App.Application项目主要定义网站页面使用的数据类&#xff0c;同时定义各类数据的增删改查操作接口和实现类。App.Application项目未安装Nuget包&#xff0c;主要引用App.Core项目的类型。   App.Application项目的顶层文件夹如下图所示&#xff0c;下面逐…...

AES加密解密算法

一&#xff0c;AES算法概述 AES属于分组加密&#xff0c;算法明文长度固定为128位&#xff08;单位是比特bit&#xff0c;1bit就是1位&#xff0c;128位等于16字节&#xff09; 而密钥长度可以是128、192、256位 当密钥为128位时&#xff0c;需要循环10轮完成加密&#xff0…...

计算机网络(05)

计算机网络&#xff08;04&#xff09; 网络负载均衡 由多台服务器以对称的方式组成一个服务器集合每台服务器都具有等价的地位 , 可以单独对外提供服务而无须其他服务器的辅助均衡负载能够平均分配客户请求到服务器列阵&#xff0c;借此提供快速获取重要数据&#xff0c;解决…...

6、ChatGLM3-6B 部署实践

一、ChatGLM3-6B介绍与快速入门 ChatGLM3 是智谱AI和清华大学 KEG 实验室在2023年10月27日联合发布的新一代对话预训练模型。ChatGLM3-6B 是 ChatGLM3 系列中的开源模型&#xff0c;免费下载&#xff0c;免费的商业化使用。 该模型在保留了前两代模型对话流畅、部署门槛低等众多…...

python面试题(1~10)

1、列表&#xff08;list&#xff09;和元组&#xff08;tuple&#xff09;有什么区别&#xff1f; ①列表是不可变的&#xff0c;创建后可以对其进行修改。元组是不可变的&#xff0c;元组一旦创建&#xff0c;就不能对其进行修改。 ②列表表示的顺序&#xff0c;它们是有序…...

分类预测 | Matlab实现CNN-LSTM-Mutilhead-Attention卷积神经网络-长短期记忆网络融合多头注意力机制多特征分类预测

分类预测 | Matlab实现CNN-LSTM-Mutilhead-Attention卷积神经网络-长短期记忆网络融合多头注意力机制多特征分类预测 目录 分类预测 | Matlab实现CNN-LSTM-Mutilhead-Attention卷积神经网络-长短期记忆网络融合多头注意力机制多特征分类预测分类效果基本介绍模型描述程序设计参…...

SQLServer CONCAT 函数的用法

CONCAT函数用于将多个字符串值连接在一起。以下是一个简单的示例&#xff0c;演示了如何使用CONCAT函数&#xff1a; -- 创建一个示例表 CREATE TABLE ExampleTable (FirstName NVARCHAR(50),LastName NVARCHAR(50) );-- 插入一些示例数据 INSERT INTO ExampleTable (FirstNam…...

python快速入门一

变量 定义一个变量并打印到控制台 message "Hello World!" print(message)控制台输出 Hello World!修改变量 message "Hello World!" print(message) message "Hello Python World!" print(message)控制台输出 Hello World! Hello Pytho…...

Elasticsearch 面试题及参考答案:深入解析与实战应用

在大数据时代,Elasticsearch 以其强大的搜索能力和高效的数据处理性能,成为了数据架构师和开发者必备的技能之一。本文将为您提供一系列精选的 Elasticsearch 面试题及参考答案,帮助您在面试中脱颖而出,同时也为您的大数据架构设计提供实战参考。 1. 为什么要使用 Elastic…...

【ARM 嵌入式 C 入门及渐进 18 -- 字符数字转整形函数 atoi 介绍】

请阅读【嵌入式开发学习必备专栏 】 文章目录 字符数字转整形函数 atoiatoi 简单实现 字符数字转整形函数 atoi 在 C 语言中&#xff0c;main 函数能够接收命令行参数。这些参数通过两个参数传递给 main 函数&#xff1a;int argc 和 char *argv[]。argc 是命令行参数的数量&a…...

全国超市数据可视化仪表板制作

全国超市消费数据展示 指定 Top几 客户销费数据展示 指定 Top几 省份销费数据展示 省份销售额数据分析 完整结果...

react native 总结

react app.js 相当与vue app.vue import React from react; import ./App.css; import ReactRoute from ./router import {HashRouter as Router,Link} from react-router-dom class App extends React.Component {constructor(props){super(props)}render(){return ( <…...

什么是自然语言处理(NLP)?自然语言处理(NLP)的概述

什么是自然语言处理&#xff1f; 自然语言处理&#xff08;NLP&#xff09;是人工智能&#xff08;AI&#xff09;和计算语言学领域的一个分支&#xff0c;它致力于使计算机能够理解、解释和生成人类语言。随着技术的发展&#xff0c;NLP已经从简单的模式匹配发展到了能够理解…...

共享旅游卡怎么使用?共享旅游卡的奥秘与魅力,解锁高效旅行的新方式

在共享经济的浪潮下&#xff0c;共享旅游卡逐渐崭露头角&#xff0c;成为众多旅行爱好者青睐的出行选择。如何有效利用这类卡片&#xff0c;使之成为节省成本、丰富旅行体验的利器呢&#xff1f; 本文将深入解析共享旅游卡的内涵、获取途径、使用要点&#xff0c;以及如何根据…...

使用yolov9来实现人体姿态识别估计(定位图像或视频中人体的关键部位)教程+代码

yolov9人体姿态识别&#xff1a; 相较于之前的YOLO版本&#xff0c;YOLOv9可能会进一步提升处理速度和精度&#xff0c;特别是在姿态估计场景中&#xff0c;通过改进网络结构、利用更高效的特征提取器以及优化损失函数等手段来提升对复杂人体姿态变化的捕捉能力。由于YOLOv9的…...

「14」四个步骤,让你在直播间轻松演义你的教案……

「14」窗口采集捕获指定程序的窗口画面 在 OBS 软件中&#xff0c;窗口采集功能可以用于捕捉特定应用程序或窗口的屏幕内容&#xff0c;以显示在直播窗口中&#xff0c;如PPT、思维导图、Word、Excel、AI、PS、腾讯会议、IPAD、手机画面等等显示窗口。 窗口采集在使用 OBS 直播…...

分解质因子

分解质因子 题目描述 将一个正整数分解质因数&#xff0c;例如&#xff0c;输入90&#xff0c;输出2 3 3 5。 输入 输入一个正整数n&#xff08;2<n<2000&#xff09;。 输出 从小到大输出n的所有质因子&#xff0c;每两个数之间空一格。 样例输入 20样例输出 2…...

iOS18系统中,苹果可能不再使用Siri,转用Gemini

生成式人工智能&#xff08;Generative AI&#xff09;是苹果公司近两年来默默投资的强大人工智能工具。 坊间流有多种传闻&#xff0c;官方最近终于曝光结果&#xff1a;苹果和谷歌正在谈判将 Gemini AI 引入 iPhone&#xff0c;预计将于今年在所有 iOS 18 设备上推出。 到目前…...

python笔记进阶--模块、文件及IO操作(1)

目录 一&#xff0e;模块 1.模块的导入和使用 1.1导入整个模块 1.2导入函数 1.3使用as给模块指定别名 2.常见标准库 2.1 import random&#xff1a; 2.2 import math&#xff1a; 2.3正则表达式处理 2.4turtle 二&#xff0e;文件及IO操作 1.文件 1.1绝对路径与相…...

单元测试框架 Junit

目录 什么是Junit&#xff1f; Junit的基础注解有哪些&#xff1f; 什么是参数化&#xff1f;参数化通过哪几种方式传输数据&#xff1f; 单参数 多参数 CSV文件获取参数 方法获取参数 测试用例执行顺序如何控制&#xff1f; 什么是断言assert&#xff1f;Assertions类…...