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. C#
  4. using .Split() without loss

using .Split() without loss

Scheduled Pinned Locked Moved C#
csharpperlquestion
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.
  • P Offline
    P Offline
    PyroManiak
    wrote on last edited by
    #1

    How do you use .split("key") without losing "key" from the seperation? I know this is possible using perl, but not sure about C#. Anyone have a solution?

    G 1 Reply Last reply
    0
    • P PyroManiak

      How do you use .split("key") without losing "key" from the seperation? I know this is possible using perl, but not sure about C#. Anyone have a solution?

      G Offline
      G Offline
      Guffa
      wrote on last edited by
      #2

      If you use Regex.Split, you can use capturing groups to get the string you are splitting on in the result, or even parts of it. Regex splitter = new Regex("(key)"); string[] result = splitter.Split(theString); --- b { font-weight: normal; }

      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