Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

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);
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #string #find #number
ADD COMMENT
Topic
Name
6+8 =