Check given string is Month name

How to check given string is Month name or not

@Sweety_Girl

Create one array of string variable with all the months and then check whether that String contains in that Array list or not.

   IF monthArray.Contains("month and")
    Then it's month name
     Else it's not month name
1 Like

@Sweety_Girl,

Try with the following code, this will return a boolean result you can check this in a IF

System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.MonthGenitiveNames.Contains("yourString") 
2 Likes

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