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++ vector sort 
Cpp :: 2d vector cpp 
Cpp :: syntax c++ 
Cpp :: strip space from string cpp 
Cpp :: max function in c++ 
Cpp :: chrono start time in c++ 
Cpp :: c++ replace string 
Cpp :: initialize whole array to 0 c++ 
Cpp :: change to lowercase character c++ 
Cpp :: split string on character vector C++ 
Cpp :: c++ nested switch statements 
Cpp :: c++ length of char array 
Cpp :: do while loop c++ loops continuously 
Cpp :: how to create array with not constant size in cpp 
Cpp :: how to get an element in a list c++ 
Cpp :: segmented sieve of Eratosthenes in cpp 
Cpp :: C++ press enter to continue function 
Cpp :: how to easily trim a str in c++ 
Cpp :: how to rotate canvas android 
Cpp :: binary representation c++ 
Cpp :: create a 2d vector in c++ 
Cpp :: naive pattern matching algorithm 
Cpp :: create copy constructor c++ 
Cpp :: loop through array c++ 
Cpp :: deep copy c++ 
Cpp :: c++ vector resize 
Cpp :: std vector random shuffle 
Cpp :: implementing split function in c++ 
Cpp :: remove first occurrence of value from vector c++ 
Cpp :: how to turn int into string c++ 
ADD CONTENT
Topic
Content
Source link
Name
5+3 =