devxlogo

CompareValue – Check whether a value is in a list of values

CompareValue – Check whether a value is in a list of values

' Compares a numeric or string value with a list of other values.' Returns the 1-based index of the matching value, or zero if the' value doesn't appear in the list.' String comparisons are case-sensitive.'' This function can conveniently replace a Select Case or a list' of ORed comparison, e.g. you can replace the following line'        If s = "one" Or s = "Two" Or s = "Three" Then' with the more concise'        If CompareValue(s, "One", "Two", "Three") ThenFunction CompareValue(ByVal value As Object, ByVal ParamArray valueList() As _    Object) As Integer    Return Array.IndexOf(valueList, value) + 1End Function

See also  Professionalism Starts in Your Inbox: Keys to Presenting Your Best Self in Email
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist