Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR 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
 
PREVIOUS NEXT
Tagged: #character #string
ADD COMMENT
Topic
Name
2+1 =