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. String split

String split

Scheduled Pinned Locked Moved C#
5 Posts 4 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
    Sebastian T Xavier
    wrote on last edited by
    #1

    Hello I just want to split a string String a = "this is a simple_sebastian_task"; I want to split it into two seperate it into two like "this is a simple" & "task" Any clue would be appreciated Thanks Sebastian

    D M 2 Replies Last reply
    0
    • S Sebastian T Xavier

      Hello I just want to split a string String a = "this is a simple_sebastian_task"; I want to split it into two seperate it into two like "this is a simple" & "task" Any clue would be appreciated Thanks Sebastian

      D Offline
      D Offline
      dan sh
      wrote on last edited by
      #2

      Use String.Substring or String.Split method. Choice depends on the way you want to break the string.

      It's not necessary to be so stupid, either, but people manage it. - Christian Graus, 2009 AD

      1 Reply Last reply
      0
      • S Sebastian T Xavier

        Hello I just want to split a string String a = "this is a simple_sebastian_task"; I want to split it into two seperate it into two like "this is a simple" & "task" Any clue would be appreciated Thanks Sebastian

        M Offline
        M Offline
        musefan
        wrote on last edited by
        #3

        You have given a subject of 'String split' but could not find the string.split method? I feel I should give you the code so you don't mess it up...

        string[] newStrings = "this is a simple_sebastian_task".Split(new string[]{"_sebastian_"}, StringSplitOptions.RemoveEmptyEntries);

        Life goes very fast. Tomorrow, today is already yesterday.

        modified on Friday, October 23, 2009 8:53 AM

        S 1 Reply Last reply
        0
        • M musefan

          You have given a subject of 'String split' but could not find the string.split method? I feel I should give you the code so you don't mess it up...

          string[] newStrings = "this is a simple_sebastian_task".Split(new string[]{"_sebastian_"}, StringSplitOptions.RemoveEmptyEntries);

          Life goes very fast. Tomorrow, today is already yesterday.

          modified on Friday, October 23, 2009 8:53 AM

          S Offline
          S Offline
          Sebastian T Xavier
          wrote on last edited by
          #4

          Hello, I have got the solution by using INDEXOF and SUBSTRING... but now I think this is the best method.. Thanks for the help

          J 1 Reply Last reply
          0
          • S Sebastian T Xavier

            Hello, I have got the solution by using INDEXOF and SUBSTRING... but now I think this is the best method.. Thanks for the help

            J Offline
            J Offline
            J4amieC
            wrote on last edited by
            #5

            So this was a SQL question all along? :rolleyes:

            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