The Common String LastChar function is used in C++ to find the last character of a string. The function takes a string as input and returns the last character of the string.
Here is an example of how to use Common String LastChar function in C++:
#include #include
using namespace std;
int main() { string str = "hello world"; char last_char = str.back(); cout << "Last character of the string is: " << last_char << endl; return 0; }
Output: Last character of the string is: d
This code uses the C++ Standard Library to get the last character of a string. In order to use the function, we need to include the header file.
The Common String LastChar function is a part of the C++ Standard Library.
C++ (Cpp) String::lastChar - 22 examples found. These are the top rated real world C++ (Cpp) examples of common::String::lastChar extracted from open source projects. You can rate examples to help us improve the quality of examples.