Line of text in an array, reading each element, problem with commas RRS feed

  • Question

  • I have a simple vbscript program which reads lines of text in a text file.
    The lines of text are in a text array.  The text array is called arrTextData
    Each line of text looks something like this:

    The code I use to read the line is :
    For each strElement IN arrTextData
      .. code

    The For Next loop reads the following data correctly:
      John 1 
    Then the code gets confused.  It does not understand to ignore the comma in "1,098.45"
     Instead the code separates the "1 and then decides the next element is 098.45"

    Question:  What code should I use to read each element of the text line which will ignore commas in a field surrounded by double quotes ?

    Sunday, January 26, 2020 2:05 AM

All replies

  • Import-Csv file.csv 

    help import-csv -online

    It takes only two lines to do this.

    VBScript is obsolete and no one should be learning it.


    Sunday, January 26, 2020 2:15 AM