In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article introduces you what is the corresponding C++string operation of C string function, the content is very detailed, interested friends can refer to, hope to be helpful to you.
String is a standard class in STL. It is used to using pointers to manipulate char * strings in C, but it is not very suitable at first. The main reason is that no suitable C++ replacement method has been found for functions in string.h. Therefore, the function substitution in commonly used sring.h is explained as follows:
Strcpy: str.substr ()
Strncpy: str.substr (pos, n)
Strcmp: = =
Strncmp: = =
Strstr: str.find ()
Strcat: str.append ()
Strchr: str.find ()
Strtok: no corresponding function, use str.find () to wrap a str.split ()
The ultimate trick:
Conversion between char * and string
Convert char to string: string str (char)
Convert string to char *: str.c_string ()
Extended Learning:
String (substr () function)
# include#includeusing namespace std;int main () {string str; cin > > str; cout
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.