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 {
2929 Component .parse(" 1.1.2-1" )
3030 Component .parse(" 8.0.192-R14" )
3131 Component .parse(" 1.2.0+9-4a769501" )
32+ Component .parse(" 1.0.0-20201119-091040" )
3233 }
3334}
Original file line number Diff line number Diff line change @@ -113,10 +113,10 @@ object Version {
113113 }
114114
115115 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
120120 (year >= 1900 && year <= 2100 ) &&
121121 (month >= 1 && month <= 12 ) &&
122122 (day >= 1 && day <= 31 )
You can’t perform that action at this time.
0 commit comments