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 tokenizer

string tokenizer

Scheduled Pinned Locked Moved C#
csharphelpquestion
4 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.
  • D Offline
    D Offline
    D Shen
    wrote on last edited by
    #1

    Hi, I would like to read/write a specific format to a flat text file. This format will contain delimiters like |, or space. I have been looking at the String class in C# to find somthing like string tokenizer. No any luck. Can someone help me out? Thanks!

    P L P 3 Replies Last reply
    0
    • D D Shen

      Hi, I would like to read/write a specific format to a flat text file. This format will contain delimiters like |, or space. I have been looking at the String class in C# to find somthing like string tokenizer. No any luck. Can someone help me out? Thanks!

      P Offline
      P Offline
      Paul Riley
      wrote on last edited by
      #2

      string str = "this|is|a|test"; string[] arr = str.Split('|'); // arr == { 'this', 'is', 'a', 'test' } // alternatively... string str = "this|is,a|test"; string[] arr = str.Split('|', ','); // gives the same result. HTH Paul

      1 Reply Last reply
      0
      • D D Shen

        Hi, I would like to read/write a specific format to a flat text file. This format will contain delimiters like |, or space. I have been looking at the String class in C# to find somthing like string tokenizer. No any luck. Can someone help me out? Thanks!

        L Offline
        L Offline
        leppie
        wrote on last edited by
        #3

        String.Split Method String Class | String Members | System Namespace Identifies the substrings in this instance that are delimited by one or more characters specified in an array, then places the substrings into a String array. Overload List Identifies the substrings in this instance that are delimited by one or more characters specified in an array, then places the substrings into a String array. public string[] Split(params char[]); Identifies the substrings in this instance that are delimited by one or more characters specified in an array, then places the substrings into a String array. A parameter specifies the maximum number of array elements to return. public string[] Split(char[], int); MYrc : A .NET IRC client with C# Plugin Capabilities. See http://sourceforge.net/projects/myrc for more info. :-D

        1 Reply Last reply
        0
        • D D Shen

          Hi, I would like to read/write a specific format to a flat text file. This format will contain delimiters like |, or space. I have been looking at the String class in C# to find somthing like string tokenizer. No any luck. Can someone help me out? Thanks!

          P Offline
          P Offline
          Philip Fitzsimons
          wrote on last edited by
          #4

          RegExp


          "When the only tool you have is a hammer, a sore thumb you will have."

          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