I am working with dates. I am writing a function which accepts the month abbr and returns the integer value for the month. I was hoping that this would be super easy and i wouldnt need a case statement.
What i have:
What i am trying to do is find a "one liner" for giving the string "constant" with the enum and getting the integer value back.
Thanks,
-The answer to your problem may not be the answer to your question.
What i have:
Code:
Class Month
Enum Months
JAN = 1
FEB = 2
MAR = 3
APR = 4
MAY = 5
JUN = 6
JUL = 7
AUG = 8
SEP = 9
OCT = 10
NOV = 11
DEC = 12
End Enum
Public Shared Function strHostMonthToIntMonth(ByVal strMonth) As Integer
Dim intMonth As Integer
Select Case strMonth
Case "JAN"
intMonth = Month.Months.JAN
Case "FEB"
intMonth = Month.Months.FEB
End Select
Return intMonth
End Function
End Class
What i am trying to do is find a "one liner" for giving the string "constant" with the enum and getting the integer value back.
Thanks,
-The answer to your problem may not be the answer to your question.