What are the commonly used string functions in C++
This article mainly explains "what are the commonly used string functions in C++", interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Now let the editor to take you to learn "what are the common string functions in C++?"
1. Introduction of common functions in cstring.h
Cstring.h library is the string.h library in C language, which is the standard library for strings in C language. C++ is compatible with this, so we can also use it in C++.
There are a large number of api about string manipulation in this library, and this article chooses some of the most commonly used ones to elaborate.
2 、 strlen
Because the compiler determines the end of a string according to the position of\ 0, the length of the string is not equal to the length of the array.
We can use the strlen function to find the true length of the string:
Char name = "hello world"; cout