Get the App
SLTechnology News&Howtos  ›  Development  › 

What are the commonly used string functions in C++

Shulou Source: shulou.com Published: 2022-06-02 18:41:42 10月31日 Update

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

Tags: Character string function length result array output run clocked content commonly used two position parameter pointer time byte actual copy point to Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info macOS Shulou Information OPPO Reno Docker