Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. checking for a substring

checking for a substring

Scheduled Pinned Locked Moved Visual Basic
helpquestion
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    ArchaBhandare
    wrote on last edited by
    #1

    I want to check if my string contains the character '"' how do I check that I am using Instr() presently, but the line of code InStr(sFile, """) but this gives an error Can you please help

    T 1 Reply Last reply
    0
    • A ArchaBhandare

      I want to check if my string contains the character '"' how do I check that I am using Instr() presently, but the line of code InStr(sFile, """) but this gives an error Can you please help

      T Offline
      T Offline
      TwoFaced
      wrote on last edited by
      #2

      Are you trying to see if the string contains a quote character? If so you need to double it up inside the string. Also are you using vb.net or vb6. If it's .net you should use the 'contains' method

          sfile.Contains("""")
      

      If it's not .net then just use

      InStr(sFile,"""")

      A 1 Reply Last reply
      0
      • T TwoFaced

        Are you trying to see if the string contains a quote character? If so you need to double it up inside the string. Also are you using vb.net or vb6. If it's .net you should use the 'contains' method

            sfile.Contains("""")
        

        If it's not .net then just use

        InStr(sFile,"""")

        A Offline
        A Offline
        ArchaBhandare
        wrote on last edited by
        #3

        I am using vb6 not .net I want to check for a double quote but only " once. Will the expression you stated above check for "" or just " , which i want

        T 1 Reply Last reply
        0
        • A ArchaBhandare

          I am using vb6 not .net I want to check for a double quote but only " once. Will the expression you stated above check for "" or just " , which i want

          T Offline
          T Offline
          TwoFaced
          wrote on last edited by
          #4

          It will check for a single double quote as in ". You need to double it up inside the string though to use it as a literal quote so you need """".

          A 1 Reply Last reply
          0
          • T TwoFaced

            It will check for a single double quote as in ". You need to double it up inside the string though to use it as a literal quote so you need """".

            A Offline
            A Offline
            ArchaBhandare
            wrote on last edited by
            #5

            Thanks, it worked

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups