delimiter

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • blessonin
    New Member
    • Jan 2008
    • 5

    delimiter

    hi all,
    I am having a notepad file which is having some fields which is seperated by space just like below
    aaa bbbb
    aaa ccc
    i want to upload each field to the database when the user click the upload button,it is working but the problem is that since i am using the space as delimiter ,if there are more than one space it is just taking the second and the fooling spaces into the array here the code i am using can anybody tell me a better options for dooig this

    dim userPostedFile As HttpPostedFile = FileUpload1.Pos tedFile
    Dim fp As StreamReader
    Dim fileContents As String = " "
    fp = File.OpenText(u serPostedFile.F ileName)
    fileContents = fp.ReadToEnd()
    Dim arrayOfStrings( ) As String = fileContents.Sp lit(" ")
    pls help me in the above matter
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    .Split() has an overload to it that takes a boolean to dictate if "empty" entries are added to the array or not.
    Just change your .Split() function to use that second parameter.

    Comment

    Working...