C++:string
char str[20] = "hello world";
string s1;
string s2 = "abc";
string s1;//创建空字符串
string s2 = "abc";//创建字符串
#include <iostream>
#include <string> //添加string头文件
using namespace std;
int main()
{string s1;string s2 = "hello world";cout << "s1:" << s1 << endl; //s1:cout << "s2:" << s2 << endl; //s2:hello worldreturn 0;
}

#include <iostream>
#include <string>
using namespace std;
int main()
{string s1("hello world");string s2("hehe");s2 = s1;cout << s2 << endl;return 0;
}
除了以上创建字符串的写法外,C++中还有一些其他的创建字符串方式。如:
string s("hello world"); //等同于string s1 = "hello world";
string s1 = s; //⽤⼀个现成的字符串s,初始化另外⼀个字符串s1
#include <iostream>
#include <string>
using namespace std;
int main()
{string s;//输入 cin >> s;//输出cout << s << endl;return 0;
}
istream& getline (istream& is, string& str);
istream& getline (istream& is, string& str, char delim);
getline(cin, string str)
//cin -- 表⽰从输⼊流中读取信息
//str 是存放读取到的信息的字符串
#include <iostream>
#include <string>
using namespace std;
int main ()
{string name;getline (cin, name);cout << name << endl;return 0;
}
getline(cin, string str, char delim)
//cin -- 表⽰从输⼊流中读取信息
//str 是存放读取到的信息的字符串
//delim 是⾃定义的结束标志
#include<iostream>
#include <string>
using namespace std;
int main ()
{string name;getline (cin, name, 'q');cout << name << endl;return 0;
}
#include <iostream>
#include <string> //添加string头⽂件
using namespace std;
int main()
{string s;string s1 = "hello";string s2 = "hello world";string s3 = "12ab!~ "; cout << "s:" << s.size() << endl;cout << "s1:" << s1.size() << endl;cout << "s2:" << s2.size() << endl;cout << "s3:" << s3.size() << endl;return 0;
}
#incldue <iostream>
#include <string>
using namespace std;
int main()
{string s = "abcdef";int i = 0;for(i = 0; i < s.size(); i++){cout << s[i] << " ";}return 0;
}
4.迭代器(iterator)
#include <iostream>
#include <string>
using namespace std;
int main()
{string s = "abcdef";string::iterator it1 = s.begin();string::iterator it2 = s.end();cout << (it1 < it2) << endl;cout << it1 - it2 << endl;return 0;
}
#include <iostream>
#include <string>
using namespace std;
int main()
{string s = "abcdef"; //auto it 是让编译器⾃动推到it的类型for (auto it = s.begin(); it != s.end(); ++it) { cout << *it << ' '; }//string::iterator 是正向迭代器类型//string::iterator it,是直接创建迭代器,it是针对字符串的迭代器for (string::iterator it = s.begin(); it != s.end(); ++it) { cout << *it << ' '; }return 0;
}
#include <iostream>
#include <string>
using namespace std;
int main()
{string s = "abcdef"; for (string::iterator it = s.end() - 1; it >= s.begin(); --it) { cout << *it << ' '; }return 0;
}
#include <iostream>
#include <string>
using namespace std;
int main()
{string str = "abcdef"; cout << str << endl;for (string::iterator it = str.begin(); it != str.end(); ++it) { *it = 'x'; }cout << str << endl;return 0;
}
#include <iostream>
#include<string> //添加string头⽂件
using namespace std;
int main()
{//向空字符串中尾插字符string s;s.push_back('h');s.push_back('e');s.push_back('l');s.push_back('l');s.push_back('o');cout << s << endl;//向⾮空字符串中尾插字符string s1 = "hello ";s1.push_back('w');s1.push_back('o');s1.push_back('r');s1.push_back('l');s1.push_back('d');cout << s1 << endl;//批量插⼊字符string s2;for (char c = 'a'; c <= 'f'; c++){s2.push_back(c);}cout << s2 << endl;return 0;
}
#include <iostream>
#include <string> //添加string头⽂件
using namespace std;
int main()
{string s = "hello";s += " world"; //字符串⽤双引号,等价于 s = s + " world"cout << s << endl;//除了+=操作,也可以使⽤'+'灵活进⾏字符串拼接//1.尾部拼接string s1 = "hello";cout << s1 + " world" << endl; //s1仍然是"hello" s1 = s1 + " world";cout << s1 << endl; //s1是"hello world" //2.头部拼接string s2 = "hello";s2 = "world " + s2 ; cout << s2 << endl; //s2为:"world hello" return 0;
}
#include <iostream>
#include<string>
using namespace std;
int main()
{string s = "hello";cout << "s:" << s << endl;//尾删s.pop_back();cout << "s:" << s << endl;//尾删s.pop_back();cout << "s:" << s << endl;return 0;
}
#include <iostream>
#include <string> //添加string头⽂件
using namespace std;
int main()
{string s;s.pop_back();return 0;
}

#include <iostream>
#include<string> //添加string头⽂件
using namespace std;
int main()
{string s = "abc";while(s.size() > 0) //通过size()函数来控制字符串的⻓度{s.pop_back();}return 0;
}
string& insert (size_t pos, const string& str); //pos位置前⾯插⼊⼀个string字符串
string& insert (size_t pos, const char* s); //pos位置前⾯插⼊⼀个C⻛格的字符串
string& insert (size_t pos, size_t n, char c);//pos位置前⾯插⼊n个字符c
#include <iostream>
#include <string>
using namespace std;
int main()
{string s = "abcdefghi";string str = "xxx";cout << s << endl;s.insert(3, str);cout << s << endl;return 0;
}
#include <iostream>
#include <string>
using namespace std;
int main()
{string s = "abcdefghi";cout << s << endl;s.insert(3, "xxx");cout << s << endl;return 0;
}
#include <iostream>
#include <string>
using namespace std;
int main()
{string s = "abcdefghi";cout << s << endl;s.insert(3, 3, 'x');cout << s << endl;return 0;
}
size_t find (const string& str, size_t pos = 0) const;
//查找string类型的字符串str,默认是从头开始查找,pos可以指定位置开始
size_t find (const char* s, size_t pos = 0) const;
//查找C⻛格的字符串s,默认是从头开始查找,pos可以指定位置开始
size_t find (const char* s, size_t pos, size_t n) const;
//在字符串的pos这个位置开始查找C⻛格的字符串s中的前n个字符,
size_t find (char c, size_t pos = 0) const;
//查找字符c,默认是从头开始,pos可以指定位置开始
//代码1
#include <iostream>
#include <string> //添加string头⽂件
using namespace std;
int main()
{string s = "hello world hello everyone";string str = "llo";//查找string类型的字符串size_t n = s.find(str);//省略第二个参数,默认为0,从头开始cout << n << endl;n = s.find(str, n + 1); //从n+1这个指定位置开始查找cout << n << endl;//查找C⻛格的字符串n = s.find("llo");//省略第二个参数,默认为0,从头开始cout << n << endl;n = s.find("llo", n + 1); //从n+1这个指定位置开始查找cout << n << endl;return 0;
}
//代码2
#include <iostream>
#include <string> //添加string头⽂件
using namespace std;
int main()
{string s = "hello world hello everyone";//在s中,0这个指定位置开始查找"word"中的前3个字符size_t n = s.find("word", 0, 3);cout << n << endl;n = s.find("everyday", n+1, 5);cout << n << endl;
return 0;
}
//代码3
#include <iostream>
#include <string> //添加string头⽂件
using namespace std;
int main()
{string s = "hello world hello everyone";size_t n = s.find('o');cout << n << endl;n = s.find('o', n + 1);cout << n << endl;return 0;
}
//查找不到的情况
#include <iostream>
#include <string> //添加string头⽂件
using namespace std;
int main()
{string s = "hello world hello everyone";string str = "bit";size_t n = s.find(str);cout << n << endl;if(n != string::npos)cout << "找到了,位置是:" << n << endl;elsecout << "没有找到" << endl;return 0;
}
static const size_t npos = -1;
#include <iostream>
#include <string> //添加string头⽂件
using namespace std;
int main()
{//注意:npos是string中定义的,使⽤npos需要带上string::指明是string类中的cout << "npos:" << string::npos << endl; //npos:18446744073709551615return 0;
}
string substr (size_t pos = 0, size_t len = npos) const;
//pos 的默认值是0,也就是从下标为0的位置开始截取
//len 的默认值是npos,意思是⼀直截取到字符串的末尾
#include <iostream>
#include<string> //添加string头⽂件
using namespace std;
int main()
{string s = "hello world hello everyone";string s1 = s.substr(7);cout << s1 << endl;string s2 = s.substr(7, 6);cout << s2 << endl;return 0;
}
#include <iostream>
#include<string> //添加string头⽂件
using namespace std;
int main()
{string s = "hello world hello everyone";size_t n = s.find("world");string s2 = s.substr(n, 10);cout << s2 << endl;return 0;
}
string s1 = "abc";
string s2 = "abcd";
char s3[] = "abcdef"; //C⻛格的字符串
(1) s1 == s2
bool operator== (const string& lhs, const string& rhs);//使⽤⽅式:s1 == s2
bool operator== (const char* lhs, const string& rhs);//使⽤⽅式:s3 == s1
bool operator== (const string& lhs, const char* rhs);//使⽤⽅式:s1 == s3
(2) s1 != s2
bool operator!= (const string& lhs, const string& rhs);//使⽤⽅式:s1 != s2
bool operator!= (const char* lhs, const string& rhs);//使⽤⽅式:s3 != s1
bool operator!= (const string& lhs, const char* rhs);//使⽤⽅式:s1 != s3
(3) s1 < s2
bool operator< (const string& lhs, const string& rhs);//使⽤⽅式:s1 < s2
bool operator< (const char* lhs, const string& rhs);//使⽤⽅式:s3 < s1
bool operator< (const string& lhs, const char* rhs);//使⽤⽅式:s1 < s3
(4) s1 <= s2
bool operator<= (const string& lhs, const string& rhs);//使⽤⽅式:s1 <= s2
bool operator<= (const char* lhs, const string& rhs);//使⽤⽅式:s3 <= s1
bool operator<= (const string& lhs, const char* rhs);//使⽤⽅式:s1 <= s3
(5) s1 > s2
bool operator> (const string& lhs, const string& rhs);//使⽤⽅式:s1 > s2
bool operator> (const char* lhs, const string& rhs);//使⽤⽅式:s3 > s1
bool operator> (const string& lhs, const char* rhs);//使⽤⽅式:s1 > s3
(6) s1 >= s2
bool operator>= (const string& lhs, const string& rhs);//使⽤⽅式:s1 >= s2
bool operator>= (const char* lhs, const string& rhs);//使⽤⽅式:s3 >= s1
bool operator>= (const string& lhs, const char* rhs);//使⽤⽅式:s1 >= s3
"abc" < "aq" //'b'的ascii码值是⼩于'q'的
"abcdef" < "ff" //'a'的ASCII码值是⼩于'f'的
"100" < "9" //'1'的ASCII码值是⼩于'9'的
#include <iostream>
#include<string>
using namespace std;
int main()
{string s1 = "hello world";string s2 = "hello";if (s1 == (s2 + " world")) {cout << "s1 == s2" << endl;}else{cout << "s1 != s2" << endl;}return 0;
}
#include <iostream>
#include <string>
using namespace std;
int main()
{string s1 = "abcd";string s2 = "abbcdef";char s3[] = "bbc";if (s1 > s2)cout << "s1 > s2" << endl;elsecout << "s1 <= s2" << endl;if (s1 == s2)cout << "s1 == s2" << endl;elsecout << "s1 != s2" << endl;if (s1 <= s3)cout << "s1 <= s3" << endl;elsecout << "s1 > s3" << endl;return 0;
}
int stoi (const string& str, size_t* idx = 0, int base = 10);
long stol (const string& str, size_t* idx = 0, int base = 10);
#include <iostream>
#include<string>
using namespace std;
int main()
{size_t pos = 0;string s1 = "11x34";int ret1 = stoi(s1, &pos, 16);cout << ret1 << endl;cout << "pos:" << pos << endl;string s2 = "11x34";int ret2 = stoi(s2, &pos, 2);cout << ret2 << endl;cout << "pos:" << pos << endl;string s3 = "0x11x34";int ret3 = stoi(s3, &pos, 0);cout << ret3 << endl;cout << "pos:" << pos << endl;return 0;
}
double stod (const string& str, size_t* idx = 0);
float stof (const string& str, size_t* idx = 0);
#include <iostream>
#include<string>
using namespace std;
int main()
{string s = "3.14x456";double ret = stod(s, NULL);cout << ret << endl;return 0;
}
string to_string (int val);
string to_string (long val);
string to_string (long long val);
string to_string (unsigned val);
string to_string (unsigned long val);
string to_string (unsigned long long val);
string to_string (float val);
string to_string (double val);
string to_string (long double val);
#include <iostream>
#include <string>
using namespace std;
int main()
{string pi = "pi is " + to_string(3.14159);cout << pi << endl;return 0;
}
相关文章:
C++:string
一、string概念 之前介绍过通过字符数组保存字符串,然后对字符数组中的字符串做各种操作;为了更加简单方便,在C中,又增加了 string 来处理字符串。 char str[20] "hello world"; string 字符串其实是一种更加高级的封…...
用c实现C++类(八股)
在 C 语言中,虽然没有内建的面向对象编程(OOP)特性(如封装、继承、多态),但通过一些编程技巧,我们仍然可以模拟实现这些概念。下面将用通俗易懂的方式,逐步介绍如何在 C 中实现封装、…...
一区10+!线粒体基因组+宏基因组,微生态研究跨界新组合
在自然界中,微生物与宿主之间的共生关系是生物多样性和生态系统功能的重要组成部分。这些相互作用不仅塑造了宿主的进化历程,而且对宿主的生存和适应性至关重要。然而,这些共生关系的进化动态和共生菌基因组的演变仍然是微生物生态学和进化生…...
基于Python编程语言的自动化渗透测试工具
摘 要 近些年来网络安全形势变得越来越严峻,全球数百万个政企遭遇过不同程度的网络攻击。渗透测试是一种对目标进行信息安全评估的方法,而目前该行业仍在存在着安全服务行业价格昂贵,安全人才缺口巨大,在渗透测试时步骤繁琐、效率…...
浅析大语言模型安全和隐私保护国内外标准和政策
过去两年,大模型技术已经普及并逐步渗透到各行各业,2025年注定是大模型应用井喷式发展的一年,AI在快速发展的同时,其带来的安全风险也逐渐凸显。人工智能系统的安全性和隐私保护已经成为社会关注的重点。 附下载:600多…...
C++例程:使用I/O模拟IIC接口(6)
完整的STM32F405代码工程I2C驱动源代码跟踪 一)myiic.c #include "myiic.h" #include "delay.h" #include "stm32f4xx_rcc.h" //初始化IIC void IIC_Init(void) { GPIO_InitTypeDef GPIO_InitStructure;RCC_AHB1PeriphCl…...
【YOLOv8杂草作物目标检测】
YOLOv8杂草目标检测 算法介绍模型和数据集下载 算法介绍 YOLOv8在禾本科杂草目标检测方面有显著的应用和效果。以下是一些关键信息的总结: 农作物幼苗与杂草检测系统:基于YOLOv8深度学习框架,通过2822张图片训练了一个目标检测模型ÿ…...
Mysql--基础篇--SQL(DDL,DML,窗口函数,CET,视图,存储过程,触发器等)
SQL(Structured Query Language,结构化查询语言)是用于管理和操作关系型数据库的标准语言。它允许用户定义、查询、更新和管理数据库中的数据。SQL是一种声明性语言,用户只需要指定想要执行的操作,而不需要详细说明如何…...
[Transformer] The Structure of GPT, Generative Pretrained Transformer
The Structure of Generative Pretrained Transformer Reference: The Transformer architecture of GPT models How GPT Models Work...
【教程】Unity 本地化多语种 | Localization 工具组
开发平台:Unity 6.0 编程平台:Visual Studio 2022 编程语言:CSharp 6.0 工具包类:Localization 一、前言 本地化多语言类型是软件面向国际化所必须的功能项。Unity 在 2022 版本后推出 Localization 工具包,以降低…...
模式识别与机器学习
文章目录 考试题型零、简介1.自学内容(1)机器学习(2)机器学习和统计学中常见的流程(3)导数 vs 梯度(4)KL散度(5)凸优化问题 2.基本概念3.典型的机器学习系统4.前沿研究方向举例 一、逻辑回归1.线性回归2.逻辑回归3.随堂练习 二、贝叶斯学习基础1.贝叶斯公式2.贝叶斯决策3.分类器…...
鸿蒙面试 2025-01-10
写了鉴权工具,你在项目中申请了那些权限?(常用权限) 位置权限 : ohos.permission.LOCATION_IN_BACKGROUND:允许应用在后台访问位置信息。 ohos.permission.LOCATION:允许应用访问精确的位置信息…...
在vscode上
第一步 安装插件 (1)从菜单处打开vscode,之后点击左侧“拓展”,在搜索栏输入“platform”,安装这个插件。 注:安装过程可能会慢一点,可以尝试连接自己的热点 (2)安装完…...
用WebGPU实现现代Web3D渲染——突破传统性能瓶颈的解决方案
引言 随着Web技术的不断发展,Web3D应用的需求不断增加。从游戏引擎到可视化工具,3D渲染技术正在被广泛地应用。然而,传统WebGL技术在性能、效率和灵活性上仍存在局限性。而WebGPU作为一种新兴的Web标准,为现代3D渲染提供了强大而…...
HTML5 加载动画(Loading Animation)
加载动画(Loading Animation)详解 概述 加载动画是指在数据加载过程中,向用户展示的一种视觉效果,旨在提升用户体验,告知用户系统正在处理请求。它可以减少用户的等待焦虑感,提高界面的互动性。 常见的加…...
.NET AI 开发人员库 --AI Dev Gallery简单示例--问答机器人
资源及介绍接上篇 nuget引用以下组件 效果展示: 内存和cpu占有: 代码如下:路径换成自己的模型路径 模型请从上篇文尾下载 internal class Program{private static CancellationTokenSource? cts;private static IChatClient? model;privat…...
Linux 高级路由 —— 筑梦之路
Linux 高级路由详解 本文将基于您提供的 Linux 高级路由极简教程 文章,深入探讨 Linux 高级路由的概念、配置方法以及应用场景。 一、什么是 Linux 高级路由? Linux 高级路由是指利用 Linux 内核提供的强大网络功能,实现超越传统路由表和默…...
实习总结(经历篇)
自从读研后,有可能是看见同龄的财会专业的同学去各种大厂实习:B站,阿里等,身边也有舍友在有过小厂实习,所以一直有个想法就是去实习,这个想法终于在研一的暑假快开始前被我赋予行动。 研一暑假和同门一起在boss等招聘软件投简历,但是当时并没有很好的对简历做修改,投递…...
【ShuQiHere】pandas 与 DataFrame 全面详解
【ShuQiHere】 本文将为您系统介绍 pandas 与 DataFrame 之间的区别,着重讲解 DataFrame 的常用方法以及相关的数据可视化操作,包括 df.hist()、df.plot()、df.boxplot() 等。无论您是数据分析新手还是有经验的专业人士,都可以从本文中快速掌…...
【回眸】发财日记
积累本金,有舍有得。 上学时在线上兼职,基本够开销没攒下钱,上班之后工资还能攒下不少。 对于花销要有舍有得。认同一句话“买东西要买能力范围内最好的”。 所以,每次花钱前都会思考: 是否需要,是否能替代已有产品&…...
文件读写到SQLite数据库的方法
在 SQLite 数据库中,将文件读写到数据库的常见方法主要有以下几种: 1. 将文件以 BLOB 类型存储 BLOB(Binary Large Object) 是 SQLite 中的二进制数据类型,可以直接用来存储文件内容。 步骤: 创建表 创建一…...
基于SDN的ddos攻击检测与防御
本项目依赖mininet, floodlight, sFlow-RT 1,启动floodlight cd floodlightjava -jar target/floodlight.jar 浏览器访问http://localhost:8080/ui/pages/index.html 或者http://localhost:8080/ui/index.html 2,创建 mininet拓扑 sudo mn --toposingl…...
RocketMQ 和 Kafka 有什么区别?
目录 RocketMQ 是什么? RocketMQ 和 Kafka 的区别 在架构上做减法 简化协调节点 简化分区 Kafka 的底层存储 RocketMQ 的底层存储 简化备份模型 在功能上做加法 消息过滤 支持事务 加入延时队列 加入死信队列 消息回溯 总结 来源:面试官:RocketMQ 和 Kafka 有…...
关于人工智能学习框架
人工智能学习框架:智能时代的强大引擎 在人工智能蓬勃发展的今天,学习框架如同一座座坚实的桥梁,连接着理论与实践,承载着创新与突破,为智能科技的前行提供了强大动力。本文将深入剖析人工智能学习框架的重要意义、核…...
Android14上使用libgpiod[gpioinfo gpioget gpioset ...]
环境 $ cat /etc/os-release NAME="Ubuntu" VERSION="20.04.5 LTS (Focal Fossa)" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Ubuntu 20.04.5 LTS" VERSION_ID="20.04" HOME_URL="https://www.ubuntu.com/" SUPPORT_URL="…...
【文件I/O】UNIX文件基础
IO编程的本质是通过 API 操作 文件。 什么是 IO I - Input 输入O - Output 输出 这里的输入和输出都是站在应用(运行中的程序)的角度。外部特指文件。 这里的文件是泛指,并不是只表示存在存盘中的常规文件。还有设备、套接字、管道、链接…...
TensorFlow Quantum快速编程(高级篇)
五、实战:量子分类器应用 5.1 数据准备 在实战构建量子分类器时,数据准备是基石环节。选用鸢尾花数据集,这一经典数据集在机器学习领域应用广泛,其涵盖了三种鸢尾花品种的样本,每个样本包含花萼长度、花萼宽度、花瓣长度、花瓣宽度四个特征。鉴于本次构建二分类量子分类…...
无人机+无人车:车机协同技术探索详解
无人机与无人车之间的协同技术是一种重要的研究方向,它结合了无人机的高空视野和无人车的地面移动能力,旨在实现更高效、灵活的作业。以下是对无人机与无人车车机协同技术的详细探索: 一、技术基础 1. 通信机制: 无人机与无人车…...
解决WordPress出现Fatal error: Uncaught TypeError: ftp_nlist()致命问题
错误背景 WordPress版本:wordpress-6.6.2-zh_CN WooCommerce版本:woocommerce.9.5.1 WordPress在安装了WooCommerce插件后,安装的过程中没有问题,在安装完成后提示: 此站点遇到了致命错误,请查看您站点管理…...
scrapy爬取图片
scrapy 爬取图片 环境准备 python3.10scrapy pillowpycharm 简要介绍scrapy Scrapy 是一个开源的 Python 爬虫框架,专为爬取网页数据和进行 Web 抓取而设计。它的主要特点包括: 高效的抓取性能:Scrapy 采用了异步机制,能够高效…...
【数据库】六、数据库设计
文章目录 六、数据库设计1 数据库设计步骤1.1 规划阶段1.2 需求分析1.3 概念设计阶段(重点)1.4 逻辑设计阶段(重点)1.5 物理设计阶段1.6 数据库的实现1.7 数据库运行与维护 2 概念模型设计2.1 ER模型2.1.1 ER模型的基本元素2.1.2 联系的设计2.1.3 采用ER模型的概念设计2.1.4 ER…...
错误的类文件: *** 类文件具有错误的版本 61.0, 应为 52.0 请删除该文件或确保该文件位于正确的类路径子目录中
一、问题 用maven对一个开源项目打包时,遇到了“错误的类文件: *** 类文件具有错误的版本 61.0, 应为 52.0 请删除该文件或确保该文件位于正确的类路径子目录中。”: 二、原因 原因是当前java环境是Java 8(版本52.0),但…...
不同音频振幅dBFS计算方法
1. 振幅的基本概念 振幅是描述音频信号强度的一个重要参数。它通常表示为信号的幅度值,幅度越大,声音听起来就越响。为了更好地理解和处理音频信号,通常会将振幅转换为分贝(dB)单位。分贝是一个对数单位,能…...
《探秘开源多模态神经网络模型:AI 新时代的万能钥匙》
《探秘开源多模态神经网络模型:AI 新时代的万能钥匙》 一、多模态模型的崛起之路(一)从单一到多元:模态的融合演进(二)关键技术突破:解锁多模态潜能 二、开源多模态模型深度剖析(一&…...
计算机网络之---端口与套接字
总括 端口:是计算机上用于标识网络服务的数字标识符,用于区分不同的服务或应用程序。套接字:是操作系统提供的用于进程间网络通信的编程接口,允许程序通过它来进行数据的发送、接收和连接管理。关系:端口号用于标识服…...
el-tabs中tabs过多造成form表单输入的时候卡顿
这里写自定义目录标题 tabs过多造成的输入卡顿解决方案方案一方案二 出现的并发问题解决方案 tabs过多造成的输入卡顿 描述:前端要写一个需求,大概有一百多个tab渲染过来,每个tab中都是一个表单,这个时候数据渲染任务加重&#x…...
vue+vite打包空白问题
在使用vuevite创建项目之后如果我们在部署项目的时候使用的不是主域名 比如www.custom.com 而是使用了www.custom.com/test 为访问域名的时候 如果不小心没有注意到这个变化 在打包上线之后会出现页面空白 js或者css404问题 我们可以在vite.config.ts去配置路径base export de…...
【python翻译软件V1.0】
如果不想使用密钥的形式,且需要一个直接可用的中英文翻译功能,可以使用一些免费的公共 API,如 opencc 或其他无需密钥的库,或直接用 requests 获取翻译结果。 其中,我可以给你一个简单的代码示例,使用 tra…...
全国青少年信息学奥林匹克竞赛(信奥赛)备考实战之循环结构(while循环应用)
实战训练1—求最大公约数 问题描述: 给定两个正整数,求它们的最大公约数。 输入格式: 输入一行,包含两个正整数。 输出格式: 输出一行,包含gcd正整数,即这两个正整数的最大公约数。 输入…...
HTTPS协议的基础与工作原理
什么是HTTPS? HTTPS(HyperText Transfer Protocol Secure)是HTTP协议的安全版本,它通过SSL/TLS协议对通信数据进行加密,确保数据的安全传输。与HTTP相比,HTTPS能防止数据被窃取、篡改或伪造,广…...
手游业务该如何选择服务器?
在网络游戏行业当中,对于服务器配置的需求是非常高的,大型的网络游戏需要服务器的高稳定性,来保证用户的游戏体验感,那么对于手游业务来说该如何进行选择服务器呢? 手游业务通常都需要处理大量的用户数据信息和并发请求…...
Python 数据建模完整流程指南
在数据科学和机器学习中,建模是一个至关重要的过程。通过有效的数据建模,我们能够从原始数据中提取有用的洞察,并为预测或分类任务提供支持。在本篇博客中,我们将通过 Python 展示数据建模的完整流程,包括数据准备、建…...
java.lang.NoClassDefFoundError: javax/xml/bind/DatatypeConverter
今天在朋友机子上运行代码,在生成token的时候,遇到了这样一个问题: Caused by: java.lang.NoClassDefFoundError: javax/xml/bind/DatatypeConverter at io.jsonwebtoken.impl.Base64Codec.decode(Base64Codec.java:26) ~[jjwt-0.9.1.jar:0.…...
12. C语言 数组与指针(深入理解)
本章目录: 前言1. 什么是数组?2. 数组的声明与初始化声明数组初始化数组 3. 访问数组元素遍历数组 4. 获取数组长度使用 sizeof 获取长度使用宏定义简化 5. 数组与指针数组名与指针的区别使用指针操作数组 6. 多维数组遍历多维数组 7. 数组作为函数参数8. 高级技巧与…...
C#用直线和曲线抗锯齿
使用 GDI 绘制一条线时,要提供线条的起点和终点,但不必提供有关线条上各个像素的任何信息。 GDI 与显示驱动程序软件协同工作,确定将打开哪些像素以在特定显示设备上显示该线条。 效果对比 代码实现 关键代码 e.Graphics.SmoothingMode Sm…...
从SS到CSS:探索网页样式设计的奥秘
一、什么是CSS CSS,全称为层叠样式表(Cascading Style Sheets),是一种用于描述HTML(超文本标记语言)或XML(包括如SVG、MathML等各种XML方言)文档样式的样式表语言。 从结构和功能的…...
[Git] git reset --hard / git reset --soft
git reset --hard 功能:重置索引(暂存区)和工作目录到指定的提交状态。这意味着它会丢弃所有未提交的更改和已暂存的更改。 适用场景:当你想要完全放弃当前工作目录中的所有更改并回退到某个特定提交状态时,可以使用这…...
OIDC IdentityServer4》》授权码模式+刷新令牌
认证服务 new Client {ProtocolType "oidc",ClientName "测试",ClientId "zen",//定义客户端 Id 要唯一ClientSecrets { new Secret("abc123zenabres89jijkomnlj".Sha256()) },//Client用来获取token// 混合模式AllowedGrantTyp…...
Sql 创建用户
Sql server 创建用户 Sql server 创建用户SQL MI 创建用户修改其他用户密码 Sql server 创建用户 在对应的数据库执行,该用户得到该库的所有权限 test.database.chinacloudapi.cn DB–01 DB–02 创建服务器登录用户 CREATE LOGIN test WITH PASSWORD zDgXI7rsafkak…...
vscode开启调试模式,结合Delve调试器调试golang项目详细步骤
1.前期准备 (1).在vs code中的扩展程序中搜索并安装Go扩展程序 (2).安装 Delve 调试器 go install github.com/go-delve/delve/cmd/dlvlatest (3).打开vs code的命令面板,输入Go: Install/Update Tools,并单击该命令执行,安装或更新Go语…...