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. Web Development
  3. ASP.NET
  4. extracting sustrings from a string to array

extracting sustrings from a string to array

Scheduled Pinned Locked Moved ASP.NET
data-structurestutorial
2 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.
  • W Offline
    W Offline
    wajans
    wrote on last edited by
    #1

    Hi I want to extract sustrings from a string and want to store in an array. The string is dynamic it will change but the criteria to extract substring is same. say for example a string str="something is [!better] than [!nothing]" so i need to extract [!better] and [!nothing] from the string and store it in a string array, the string is dynamic it changes but i need to extract data between [ and ] including both the square brackets. If anybody can send any sample code, I will be very thankfull. Thanks Ansari

    L 1 Reply Last reply
    0
    • W wajans

      Hi I want to extract sustrings from a string and want to store in an array. The string is dynamic it will change but the criteria to extract substring is same. say for example a string str="something is [!better] than [!nothing]" so i need to extract [!better] and [!nothing] from the string and store it in a string array, the string is dynamic it changes but i need to extract data between [ and ] including both the square brackets. If anybody can send any sample code, I will be very thankfull. Thanks Ansari

      L Offline
      L Offline
      Linda1st
      wrote on last edited by
      #2

      // I could be off by one string strXX = "xxx [ xxx ],,,,"; int startX = strXX.IndexOf("["); int endX = strXX.IndexOf("]"); strXX.Substring( startX, (endX - startX+1); // I hopes this help; Signed... Linda

      xxx

      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