Hi All I am a beginner and I am learning Objectscript and I would appreciate a steer regarding a problem I am solving. The issue I have spent some time on resolving without success is that I have the stream listed below and as you can see it has some gaps in it. Stream das is wp dsa nmk Here is the import method
IF ##class(%File).Exists(dir) '=1 {
    write !, "Unable to Open: "_dir
    QUIT
} ELSE {
    write "File: "_dir_" is open"
}
// instantiate a new class called file
set file = ##class(%Stream.FileCharacter).%New()
// create a new variable called sc
set sc = file.LinkToFile(dir)
set count=1
WHILE ('file.AtEnd) {
    set delim=" "
    set line = file.ReadLine()
    set i=1
    write !, "Loop started"
    write *32
    if (line '="") {
        write !, "Read started"
        write *32
        set ^answers(count)=$LISTFROMSTRING(line, delim)
        write *32
        set ^attempt(count)=^attempt(count)_$ZHEX(($ASCII($LIST(^answers(count)))))
        write "Attempt:", ^attempt(count) ,!
        set countdown=$LENGTH(line,delim)
        set i=$INCREMENT(i)
        set count=$INCREMENT(count)
    }
}
Reading from streams is sequential and I have been trying to find a way of using LISTFROMSTRING to read these values. The issue is that I have been having some trouble trying to account for the blank spaces and they stop the program from running in its tracks. I have tried using $EXTRACT and $PIECE and I want to be able to remove these null spaces when writing the lines out to the subscripted variable. What would be the best way of reading in the values whilst bearing in mind that I don't want to have any blank spaces within any list I create? BTW I am open to using globals, arrays or local variables Thanks in advance and I really do appreciate any assistance on this.