Checking for text in a string

Checking a list of rows to see if the string in the row contains the first day of the month.

e.g. This expression, var.Contains(“2020-03-01”), would be true if the variable has the string “abc+2020-03-01+cba”.

However if the string was “def+2020-02-01+fed” it would be false.

Wondering if there is a way to check in the string for the first day no matter the month or year.

var.Contains(Now.ToString(“yyyy-MM”)+"-01"))

Hey @Nelson.R,

I would approach it this way:

Get the variable in the row which is the date you want checked, then turn it into a DateTime variable (either Parse date, or CDate), then you could check if the dd part = 01.

Here is how:
Use a For each row loop and inside that, use a Get row Item to retrieve the correct column in each row that contains your date variable.
Call the row date something like: DateVar (genericvalue type variable will work fine)
Then in an assign do this code: DateVar = CDate(DateVar).ToString(“dd-MM-yyyy”)
Then an IF statement: DateVar.ToString.SubString(0,2)=“01”
THEN: Add message box “this is the first of the month” <- can do anything here you want really, message box was used as example only.
ELSE: add message box “this is not the first of the month”

Cheers
MikeB

Thank for the suggestion. Given my situation that the data under the column follows the same string patter i just ended up taking out the day using the substring method.

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