#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2016
    Posts
    16
    Rep Power
    0

    How do I use if statement to check number in string array?


    My shared sub, the strCitationNumbers string array can have a number or 'No match' text.

    I would like to add if statement to check strCitationNumbers has a number in it.
    If a number (string) is found in the strCitationNumbers, I want to output an error message saying 'Duplicate case found'.
    How do I do it?
    Code:
    Shared Sub TestCitationGetCaseNumber()
             Dim strCitationNumbers() As String
            Dim strCitationNumber As String = "2770043451123"
     strCitationNumbers = Msc.Integration.Mncis.Library.v4.Citation.GetCaseNumbersForCitation(strCitationNumber, False)   End Sub
  2. #2
  3. Lazy Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    16,436
    Rep Power
    9645
    If it's either "No match" or a number, can't you just test whether the value is/isn't "No match"?
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2010
    Posts
    126
    Rep Power
    161
    you need to traverse the citation numbers from the first to the penultimate with a loop "a" and within that loop you need a second loop "b" that traverses the citation numbers from the second one to the last
    when the citation numbers match you can report the citation number back as a duplicate. this will report all duplicates, if the report contains duplicate numbers then the citation number has been use more than twice.

    straight forward to code

    here to help

IMN logo majestic logo threadwatch logo seochat tools logo