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

find last occurrence of character in string c++

auto find_char = 'a'
size_t last_occurence_index = str.find_last_of(find_char);
Comment

how to find last character of string in c++

String[strlen(String) - 1];
Comment

c++ string find last number

//Example
string str = "sdfsd34";

//Find the first first number and then all the number after
str.substr(str.find_first_of("0123456789"))

//Find the last number
size_t last_index = str.find_last_not_of("0123456789");
string result = str.substr(last_index + 1);
Comment

PREVIOUS NEXT
Code Example
Cpp :: c++ fstream create if not exists 
Cpp :: rand() c++ 
Cpp :: reverse level order traversal 
Cpp :: untitled goose game 
Cpp :: how to search in array c++ 
Cpp :: how to print a text in c++ 
Cpp :: how to convert ascii to char in cpp 
Cpp :: reverse function in cpp array 
Cpp :: string split by space c++ 
Cpp :: classes and objects in c++ 
Cpp :: check prime cpp gfg 
Cpp :: C++ fill string with random uppercase letters 
Cpp :: string search c++ 
Cpp :: find in vector 
Cpp :: print two dimensional array c++ 
Cpp :: c++ looping through a vector 
Cpp :: C++ New Lines 
Cpp :: find in unordered_map c++ 
Cpp :: cin exceptions c++ 
Cpp :: cpp auto 
Cpp :: c++ check if debug or release visual studio 
Cpp :: how to make a square root function in c++ without stl 
Cpp :: how to reverse a vector in c++ 
Cpp :: c++ inheritance constructor 
Cpp :: int max in c++ 
Cpp :: Chocolate Monger codechef solution in c++ 
Cpp :: print fps sfml 
Cpp :: c++ comment out multiple lines 
Cpp :: remove something from stringstream 
Cpp :: closing a ifstream file c++ 
ADD CONTENT
Topic
Content
Source link
Name
3+1 =