How To fetch last Interger from string c++ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How To fetch last Interger from string c++

string s="id1=100",y="I=20"; How can I print 100,20 in cpp

13th Aug 2020, 6:26 AM
Gireesh Desineni
Gireesh Desineni - avatar
4 Answers
13th Aug 2020, 6:35 AM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar
13th Aug 2020, 6:39 AM
Gireesh Desineni
Gireesh Desineni - avatar
0
Мг. Кнап🌠 what if there is a space after = ?!
13th Aug 2020, 7:25 AM
Gireesh Desineni
Gireesh Desineni - avatar
0
I mean chances are that you may have numbers on the left of = as well, so that would alao be a problem, so you don't need those numbers right, so the options which we have is to extract numbers after the equal sign, we can use this method and add a space in the delimetere variable Or we can use regular expressions
13th Aug 2020, 7:31 AM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar