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 tokenize

string tokenize

Scheduled Pinned Locked Moved C#
3 Posts 3 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.
  • L Offline
    L Offline
    lawrenceinba
    wrote on last edited by
    #1

    char[] delimiters = { ',', '#', ';', ' ', '/', '\0', '&', '-' }; strTemp = a[i].Split(delimiters, StringSplitOptions.RemoveEmptyEntries); #69;xx street;yy city(input) given the above input, it should split based on the delimiter... the above code removes the delimiter...but the delimiters should be retained... is there any method to do this... thanks in advance

    the quieter u become more u hear

    V S 2 Replies Last reply
    0
    • L lawrenceinba

      char[] delimiters = { ',', '#', ';', ' ', '/', '\0', '&', '-' }; strTemp = a[i].Split(delimiters, StringSplitOptions.RemoveEmptyEntries); #69;xx street;yy city(input) given the above input, it should split based on the delimiter... the above code removes the delimiter...but the delimiters should be retained... is there any method to do this... thanks in advance

      the quieter u become more u hear

      V Offline
      V Offline
      Vikram A Punathambekar
      wrote on last edited by
      #2

      You could go through the result, appending the delimiter. Of course, you'd have to use the delimiters one by one. Or write your own method. Regex may work as well, not totally sure.

      Cheers, Vıkram.


      I've never ever worked anywhere where there has not been someone who given the choice I would not work with again. It's a job, you do your work, put up with the people you don't like, accept there are probably people there that don't like you a lot, and look forward to the weekends.   - Josh Gray.

      1 Reply Last reply
      0
      • L lawrenceinba

        char[] delimiters = { ',', '#', ';', ' ', '/', '\0', '&', '-' }; strTemp = a[i].Split(delimiters, StringSplitOptions.RemoveEmptyEntries); #69;xx street;yy city(input) given the above input, it should split based on the delimiter... the above code removes the delimiter...but the delimiters should be retained... is there any method to do this... thanks in advance

        the quieter u become more u hear

        S Offline
        S Offline
        S Dhanasekaran
        wrote on last edited by
        #3

        bool chkspchar = Regex.IsMatch(txtBrandName.Text, "[^A-Za-z0-9-]+"); if(!chkspchar) { strBrandName = Regex.Replace(txtBrandName.Text, "[^A-Za-z0-9-]+", "").Trim().ToLower(); }

        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