+ 1

How to check date format for string

Hello I have an input string which I want to verify whether it has specific format or not... Like dd-mm-yy or dd-mmm-yy One way which is very trivial is to check out for index of - and then ensure that portion left out is following date , month and year range.... Is there any standard way of checking this out rather than doing on our own by manipulating string operation.... Unfortunately , I have code where I can't use boost or other third party code.. only c++ functionality is allowed to be used... Any pointers would be of great help...

7th Sep 2020, 7:24 PM
Ketan Lalcheta
Ketan Lalcheta - avatar
2 Réponses
+ 3
you could try regex
7th Sep 2020, 9:02 PM
Flash
0
This came to my mind while implementation but I heard some where that regex is something which is too slow and one should not opt for it..
8th Sep 2020, 8:47 PM
Ketan Lalcheta
Ketan Lalcheta - avatar