当前位置:网站首页>String class
String class
2022-07-25 02:22:00 【asibble】
string class
effect
Things related to string processing , Head for vector, Make a statement of relevant contents .
Basically, the methods used can be the same as general c++ Basically the same way .
iterator
Similar pointer pointing string Related things in the class array .

Spatial growth problem ( Capacity )
size Returns the valid character length of a string
length Returns the valid character length of a string
capacity Returns the total space size ( The amount of space created !)
empty Check whether the space is empty , Empty return true, Don't put false
clear Clean up all the strings
void clear();reserve(size_t n) Let the string become the corresponding space size n
void reserve (size_t n = 0);resize Re divide n Space , Use all the empty space c Fill in
void resize (size_t n);
void resize (size_t n, char c);
string Object access and traversal
[ ] return pos Character information of position
begin And end iterator
Range for
string Class object modification operation
push back Insert characters c In string
void push_back (char c);append Append a string to the string str
iterator string& append (const string& str);// Attach a copy string& append (const string& str, size_t subpos, size_t sublen);// Substring with subpos Index start , The length is sublen( There is no default to npos Specific location information ) string& append (const char* s);// Copy it all string& append (const char* s, size_t n);// front n Go up string& append (size_t n, char c);// add to n Characters c template <class InputIterator> string& append (InputIterator first, InputIterator last); // Connect things in the iterator scope to the end
operator String is appended after string str‘
c_str return c Format string
const char* c_str() const;
npos Represents the last of the string ( character ) The specific information of the position behind the position .
find Find relevant content information
ize_t find (const string& str, size_t pos = 0) const; // Looking for from pos Position start to end size_t find (const char* s, size_t pos = 0) const; // ditto size_t find (const char* s, size_t pos, size_t n) const; // Find the string n Something , from pos Location start related information size_t find(char c,size_t pos = 0)const; // Find directly from pos Start
substr Return character
string substr (size_t pos = 0, size_t len = npos) const;Interception from pos To the back len Characters
———————————————————————————————————
This part comes to my own learning summary ! If there is any mistake, please point out !
边栏推荐
- Jsonp solves cross domain plug-ins (JS, TS)
- Deep understanding of string class
- Contemporary fairy quotations
- After six years of precipitation, new consumption has found a digital transformation paradigm
- After upgrading v2.1.0, the synchronization failed
- Let's customize the loader
- What are the important trends revealed by the release of "operator data viability index"?
- Simulate the implementation of strstr
- Remove & lt; li&gt; Front blank distance
- Componentization and modularization
猜你喜欢

Easy to master SSO single sign on, see this article

Server performance monitoring

Promise basic use

After six years of precipitation, new consumption has found a digital transformation paradigm

How can arm access the Internet through a laptop?

Unable to display spline in UE4 (unreal engine4) terrain editing tool

Hongmeng harmonyos 3 official announcement: officially released on July 27; Apple slowed down the recruitment and expenditure of some teams in 2023; Russia fined Google 2.6 billion yuan | geek headlin

Full analysis of new functions of report design tool FastReport online designer v2022.1

Upgrade the leapfrog products again, and the 2023 Geely Xingrui will be sold from 113700 yuan
![[hero planet July training leetcode problem solving daily] 20th BST](/img/25/2d2a05374b0cf85cf123f408c48fe2.png)
[hero planet July training leetcode problem solving daily] 20th BST
随机推荐
Management mode of agricultural science data center based on life cycle theory
Data integration | what are the tools for data integration at home and abroad?
Industrial control safety PLC firmware reverse III
Componentization and modularization
Several application scenarios of NAT
Standard transfer function
"No such plugin: cloudbees folder" solution appears when Jenkins selects the recommended plug-in for the first time
Win10 configuring CUDA and cudnn
Talk about what's going on with C # backstage GC?
Deep understanding of string class
Data management process model of science and technology planning project
Scientific data center resources and user access control system
Coal industry supply chain centralized mining system: digitalization to promote the transformation and upgrading of coal industry
xts performance auto fix script
After six years of precipitation, new consumption has found a digital transformation paradigm
I was forced to graduate by a big factory and recited the eight part essay in a two-month window. Fortunately, I went ashore, otherwise I wouldn't be able to repay the mortgage
Eolink - quickly develop interfaces through document driven
H5 common positioning function package
Completefuture parallel asynchronous return processing
Let's customize the loader