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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. Visual Basic
  4. substring in an array

substring in an array

Scheduled Pinned Locked Moved Visual Basic
data-structuresquestion
5 Posts 5 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.
  • S Offline
    S Offline
    Sonia Gupta
    wrote on last edited by
    #1

    i have an array of size 600 .It's type is string dim str(599) as string Each item has some value. Now my question is instead of looping for 599 times to seek the substring. Is there any function that directly find out the particular substring , without using looping.

    M G D C 4 Replies Last reply
    0
    • S Sonia Gupta

      i have an array of size 600 .It's type is string dim str(599) as string Each item has some value. Now my question is instead of looping for 599 times to seek the substring. Is there any function that directly find out the particular substring , without using looping.

      M Offline
      M Offline
      Manas Bhardwaj
      wrote on last edited by
      #2

      No :sigh:

      1 Reply Last reply
      0
      • S Sonia Gupta

        i have an array of size 600 .It's type is string dim str(599) as string Each item has some value. Now my question is instead of looping for 599 times to seek the substring. Is there any function that directly find out the particular substring , without using looping.

        G Offline
        G Offline
        GoodID
        wrote on last edited by
        #3

        Hi, You can join that array to string variable and search the particular substring from string variable with substring function GoodID

        1 Reply Last reply
        0
        • S Sonia Gupta

          i have an array of size 600 .It's type is string dim str(599) as string Each item has some value. Now my question is instead of looping for 599 times to seek the substring. Is there any function that directly find out the particular substring , without using looping.

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          No, there isn't. Your only other option is to create one MASSIVE string out of all the strings in your array and use the substring method on that. The problem with this method is that it will use twice as much memory as just searching through the array because not your storing each string in the array a second time in the massive string that you built to avoid using the loop.

          A guide to posting questions on CodeProject[^]
          Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
               2006, 2007

          1 Reply Last reply
          0
          • S Sonia Gupta

            i have an array of size 600 .It's type is string dim str(599) as string Each item has some value. Now my question is instead of looping for 599 times to seek the substring. Is there any function that directly find out the particular substring , without using looping.

            C Offline
            C Offline
            ctwalker
            wrote on last edited by
            #5

            You could use something other than an array. Depending on what you are trying to accomplish you may want to use an ArrayList. It has a Contains Boolean function that will let you know if an item is in the array. You might also look at the HashTable. It stores items in a Key - Value pair. Great for doing direct retrievals when you know the key.

            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