File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed
benchmark/src/main/scala/org/scalasteward/benchmark
core/src/main/scala/org/scalasteward/core/data Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -29,5 +29,6 @@ class VersionBenchmark {
29
29
Component .parse(" 1.1.2-1" )
30
30
Component .parse(" 8.0.192-R14" )
31
31
Component .parse(" 1.2.0+9-4a769501" )
32
+ Component .parse(" 1.0.0-20201119-091040" )
32
33
}
33
34
}
Original file line number Diff line number Diff line change @@ -113,10 +113,10 @@ object Version {
113
113
}
114
114
115
115
private def startsWithDate (s : String ): Boolean =
116
- """ (\d{4})(\d{2})(\d{2}) """ .r.findPrefixMatchOf(s).exists { m =>
117
- val year = m.group( 1 ).toInt
118
- val month = m.group( 2 ).toInt
119
- val day = m.group( 3 ).toInt
116
+ s.length >= 8 && s.substring( 0 , 8 ).forall(_.isDigit) && {
117
+ val year = s.substring( 0 , 4 ).toInt
118
+ val month = s.substring( 4 , 6 ).toInt
119
+ val day = s.substring( 6 , 8 ).toInt
120
120
(year >= 1900 && year <= 2100 ) &&
121
121
(month >= 1 && month <= 12 ) &&
122
122
(day >= 1 && day <= 31 )
You can’t perform that action at this time.
0 commit comments