This topic provides code samples for checking the contents of variables.
-
Checks if the string matches the given input and returns False
myString = "Thank God It's Monday" myBoolean = myString.Equals("Monday")
-
Checks if the string contains the given input and returns True
myBoolean = myString.Contains("Monday")
-
Checks if the string starts with the given input and returns False
myBoolean = myString.StartsWith("Monday")
-
Checks if the string ends with the given input and returns True
myBoolean = myString.EndsWith("Monday")
-
Returns -1 if time1 is earlier than time2, returns 0 if time1 is equal to time2, and returns 1 if time1 is later than time2.
myInteger = DateTime.Compare(time1, time2)