Common member function
string substr (size_t pos = 0, size_t len = npos) const;
Returns a new one
A copy of the String object that is initialized to a substring of the String object.
substring is the part of the object that starts at character position pos and spans len characters (or up to the end of the string, whichever comes first).
The position of the first character is copied as a substring.
this function returns an empty string if this is equal to the length of the string.
if this is greater than the length of the string, it will throw out_of_range.
note: the first character is represented as the value 0 (not 1).
The number of characters included in the subscript (if the string is short, as many characters as possible can be used as needed).
string :: non-profit value represents all characters up to the end of the string.
size_t is an unsigned integral type (the same as member type)
The return value A
String Object with a substring of this object.
think live in details.
- C language string processing error warning, c4996, sprintf, predicted, c4996, strcpy, c4996, strcat
- Differences between length() size() and C strlen() of C + + string member functions
- Solve the problem of error: cannot pass objects of non trivially copyable type ‘STD:: String’ in C / C + +
- A repeated string is composed of two identical strings. For example, abcabc is a repeated string with length of 6, while abcba does not have a duplicate string. Given any string, please help Xiaoqiang find the longest repeated substring.
- C++ foundation — clear/erase/pop of string class_back
- ParserError: Error tokenizing data. C error: EOF inside string starting at row 917
- Unity short string intercepts long string
- TSLint：object access via string literals is disallowedtslint(no-string-literal)
- 1067 – Invalid default value for ‘sex‘1366 – Incorrect string value: ‘\xE6\x8A\x80\xE6\x9C\xAF…‘ f
- C++：error C2228: left of ‘.str’ must have class/struct/union
- Error c2137 of C language: empty character constant (Fixed)
- C / C + + library function (tower / tower) realizes the conversion of letter case
- Finding the longest connection path of a string
- C / C + + error handling (document): unhandled exception: 0xc0000005: access violation while reading location 0x00000000
- C / C + + rounding function ceil(), floor ()
- error C2057: expected constant expression (Can the size of an array in C language be defined when the program is running?)
- Translate() and maketrans() methods of string in Python
- Error C2664 in C + + compilation: cannot convert parameter 2 from “const char ” to “lpctstr” solution.
- Python string prefix
- Solution to the flash of running result of dev C / C + +