How do you compare multiple strings at once

Posted on 2005-04-15
Last Modified: 2012-06-21
To: All

I would like to compare multiple strings at once.  I want to see if there all the same.

The below example doesn't work.

Dim stringA as String
Dim stringB as String
Dim stringC as String

stringA = "help"
stringB = "help"
stringC = "help"

if(stringA = stringB = stringC) Then"all equal")
End If

Question by:vaultworld
    LVL 12

    Accepted Solution

    Dim stringA as String
    Dim stringB as String
    Dim stringC as String

    stringA = "help"
    stringB = "help"
    stringC = "help"

    if(stringA = stringB  AndAlso stringB = stringC) Then"all equal")
    End If


    I only just learnt about the AndAlso operator... it won't bother going onto the second comparison if the first one fails
    LVL 1

    Author Comment

    Very Cool,  Thanks

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    Suggested Solutions

    Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
    The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (…
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now