I can use more than one char to use .Split(). Like this .Split("\,").

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gabielmatos
    New Member
    • Oct 2009
    • 25

    I can use more than one char to use .Split(). Like this .Split("\,").

    Good morning,

    I'm reading a csv file. My problem is that when I use the comma delimiter brings me more fields that have the line. This is because some fields contain commas in them. An example of a line;

    "1234564", "2", "Torres and Family, Inc.", "Ave # 56 calle 3 lurdes building, suite 108","","","787 8548545"

    when I use comma delimiter brings more fields, as there are other commas in the data.

    Thank you in advance,
  • Dheeraj Joshi
    Recognized Expert Top Contributor
    • Jul 2009
    • 1129

    #2
    use Regex.Split like below...

    Code:
    Regex.Split(value,"\,");
    if
    Code:
    \,
    don't appear together every time then i think you have to do above code 2 times once for "\" and then for ",".

    Regards
    Dheeraj Joshi

    PS:Please use code tag for posting code.

    Comment

    • gabielmatos
      New Member
      • Oct 2009
      • 25

      #3
      Thank you, Mr. Dheeraj Joshi for your quick response.

      Comment

      Working...