dcsimg
Results 1 to 13 of 13

Thread: [RESOLVED] Issue with parsing

Threaded View

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Feb 2015
    Location
    USA, New Jersey
    Posts
    23

    Resolved [RESOLVED] Issue with parsing

    Any help will be appreciated.
    After remove the first line I could not figure out, should I use select case, maybe InStr with vbBinaryCompare ...

    This is the string I need to parse.

    From 9:30AM until 4:00PM - Only show time 11:30:54 AM,

    symbol,latestTime,open,high,low,close,
    PSEC,11:30:54 AM,6.63,6.64,6.61,6.61
    ' This one works fine

    After 4:00 PM - show March 15, 2019,
    symbol,latestTime,open,high,low,close,
    PSEC,"March 15,2019",6.63,6.64,6.61,6.61,

    Code:
     Function ParseStockQuote&(Main$, tStockDetails As StockDetails)
    tMain$ = Main$
    On Error Resume Next 'GoTo ParseError
    With tStockDetails
      DoEvents
           '******** Remove first line ************
      Call StripFirstLine$(tMain$) ' to remove first line
      Debug.Print tMain$
      
           Dim CSV$(1 To 6)
      For n& = 1 To 6
        CSV$(n&) = SubtractString$(tMain$, ",")
      
       Next
       .Ticker = CSV$(1) 'PSEC
       .LatestTime = CSV$(2) 'Time
        
     If LatestTime = "N/A" Then 'no date no good
        ParseStockQuote& = 2 'not a valid date resubmit ? 
        Exit Function
      
     End If
     
     .Open = Val(CSV$(3))          
     .High = Val(CSV$(4))         
     .Low = Val(CSV$(5))           
     .Close = Val(CSV$(6))
     
     'If InStr(tTime$, "chr$(58)", vbBinaryCompare) = 0 Then  'I m trying use
     
      
     Else
       
        Exit Function
                                                               
      End Function
    Last edited by Tony.; Mar 18th, 2019 at 10:42 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width