detect integer next to any character java | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

detect integer next to any character java

I want a possible way to detect int next to any character or string. for example 88+34 I want my code to detect and use 34 as it is the next integer to + sign. How is it possible?

24th Sep 2018, 6:19 PM
Rifat Bin Salam
Rifat Bin Salam - avatar
1 Answer
0
Use a Regular Expression which matches a non-digit followed by one or more digits, then return the digits. The actual expression varies a little with language, but will be similar to /[^\d](\d+)/.
25th Sep 2018, 1:48 AM
Emerson Prado
Emerson Prado - avatar