-3

Hi guys basically I need to check whether the version-no is in format x.y where both x and y should be in between[0-9] Ex:1.1, 1.2, 2.3, 4.5 etc

I am a novice to java....I was thinking of splitting the string using "." and then check whether both are integers....but i think it can be done using regex..which i am not able to do....can anyone help me in this regard...

raghuveer
  • 83
  • 4

1 Answers1

0

You can do it with regex:

str.matches("\\d\\.\\d")

\d is a digit, and \. is the literal . character.

Aplet123
  • 27,379
  • 1
  • 13
  • 35