How to checkstatement contains givn spcific thing

How to checkstatement contains givn spcific thing

Home Forums Ask Expert How to checkstatement contains givn spcific thing

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #32681
    Sasha ZAP
    Moderator

      Hello saikrishna.m ,

      First you need to break the string into separate characters, then save a character in a variable;
      Then you use VBScript functions such as InStr to check if this character exists in a collection of all the a to z, number 0 to 9 and hyphens (You set this as a string of all required characters). 
      For example:
      strAllcharacters = “abcdefghijklmnopqrstuvwxyz”
      strCharacter = Left(strYourString, 1)
      If InStr(strAllcharacters, strCharacter) Then…

      Hope this helps.

      Thanks,
      ZAPTEST Team

      #32682
      Sergey ZAP
      Keymaster

        Alternative way is to use RegExpMatch ZAP method.
        In this example I use regular expression to match any letter , any number, and hyphen.

        StringToVerify=”01548-adsIJH”
        RegExpResult= zap.Common.RegExpMatch(StringToVerify,”[a-zA-Z0-9-]*”)
        If len(StringToVerify)=len(RegExpResult) then
        msgbox “Verification Passed”
        else
        msgbox “Verification Failed”
        end if

        #32683
        sai krishna macherla
        Participant

          it is showing as a “object does not support this property or method :zap.common.RegExpMatch

          #32684
          Sergey ZAP
          Keymaster

            You may need to update ZAPTEST.
            Please download latest version from the website (www.zaptest.com)

          Viewing 4 posts - 1 through 4 (of 4 total)
          • You must be logged in to reply to this topic.

          Virtual Expert

          ZAPTEST

          ZAPTEST Logo