Search
 
SCRIPT & CODE EXAMPLE
 

CPP

c++ get last character of string

// Example
YourStr.substr(YourStr.length() - 1)

// Syntax
std::string YourStr = "abcdef";
std::cout << YourStr.substr(YourStr.length() - 1) << "
"; // OUTPUT: f
Comment

PREVIOUS NEXT
Code Example
Cpp :: cpp mark getter as const 
Cpp :: c++ namespace 
Cpp :: ++i and i++ 
Cpp :: sort array c++ 
Cpp :: convert 2d array to 1d c++ 
Cpp :: c++ print out workds 
Cpp :: how to use toString method in C++ 
Cpp :: if statement c++ 
Cpp :: best websites for programming 
Cpp :: how to turn int into string c++ 
Cpp :: operand-- c++ 
Cpp :: function overloading in c++ 
Cpp :: how to download c++ portable compiler 
Cpp :: std::copy C ++ 
Cpp :: c++ split string by space into array 
Cpp :: c++ access second last element of vector 
Cpp :: array of struct in c++ 
Cpp :: why convert char* to string c++ 
Cpp :: define vector with size and value c++ 
Cpp :: cpp linked list 
Cpp :: stl in c++ 
Cpp :: c++ check if key exists in map 
Cpp :: User defined functions and variables in C++ programming 
Cpp :: c++ open webpage 
Cpp :: how to write int variable c++ 
Cpp :: string concatenation operator overloading c++ 
Cpp :: auto in c++ 
Cpp :: how to extract a folder using python 
Cpp :: Split a number and store it in vector 
Cpp :: cpp vector structure 
ADD CONTENT
Topic
Content
Source link
Name
2+7 =