How to get all years if I provide start and end year

Hi,

Example:
Variable1 = 2013-2017

from this, I need to get all the years from 2013 to 2017.
expected output array should be = 2013, 2014, 2015, 2016, 2017

we can parse the string e.g. by regex

arrYears = Regex.Matches(YourString,"\d{4}").Cast(Of Match).Select(Function (m) CInt(m.toString)).toArray

grafik

Ensure:
grafik

If sorting is needed we can do otherwise first is oldest

arrYearSequence = Enumerable.Range(arrYears (0),arrYears (1)-arrYears (0) + 1).toArray

@ppr 1 should be added to the difference

1 Like

@kumar.varun2
thanks for the catch
grafik

Thank you, This is working perfectly

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.