1

我正在使用下面的代码来编译纳斯达克证券交易所的股票代码列表。我正在使用位于此处的 CSV 文件:http ://www.nasdaq.com/screening/companies-by-industry.aspx?exchange=NASDAQ&render=download

当我在 Excel 中打开 CSV 文件时,股票代码周围没有引号。但是当我运行下面的代码时。返回到我列表中的所有股票代码都有引号。为什么是这样?以及如何摆脱引号?

这是我的代码:

Public Shared tickerList As New List(Of String)
Dim compositeList As New List(Of String) 
Dim strBuffer As String
        strBuffer = Historical_Stock_Prices.RequestWebData(http://www.nasdaq.com/screening/companies-by-industry.aspx?exchange=NASDAQ&render=download)
        Dim sReader As New StringReader(strBuffer)
        Dim Line_List As New List(Of String)
        Do While sReader.Peek >= 0
            Line_List.Add(sReader.ReadLine)
        Loop
        Line_List.RemoveAt(0)
        For Each Line In Line_List
            compositeList.Add(Line.Split(",")(0).Trim.ToLower)
        Next
        sReader.Close()
tickerList = compositeList.Distinct.ToList
tickerList.Sort()
4

2 回答 2

3
compositeList.Add(Line.Split(",")(0).Trim(New Char() {""""}).ToLower)
于 2013-11-08T19:20:11.453 回答
2
myString = myString.Substring(1, myString.Length -1)

这将删除第一个和最后一个字符。

于 2013-11-08T19:17:19.077 回答