How to enumerate list items from a CSV array

Answered How to enumerate list items from a CSV array

  • Sunday, June 03, 2012 6:48 PM
     
      Has Code

    I have done this with import-csv using a CSV file, but I cannot sort out how to do this with a comma-separated array of values. Can anyone offer up an idea?

    I need to take the values in this array

    $StrArray = "value1, value2, value3"
    
    #Split on the comma
    
    <?>
    
    #And then take some action in a for.next loop (one at a time)
    
    ForEach ($StrValue in $StrArray) {
    
    Write-host StrValue[X]
    
    }


All Replies