Recently I have been working with a text file from which I read a series of comma delimited lines. Each item represents a series of numbers, like this:
The problem is that the FileReadLine function strips out the commas and reads the line as one huge number. It even adds exponent notation such as +E25 to the end, so I know it is interpreting it as a number. Worse yet, if the data is a line of zeros, like this:
It will ignore it entirely and return a blank string. I even tried using the ToString Function wrapped around the FileReadLine function, but it still didn't work. I finally Tried using semi-colons in place of the commas, which worked. So I have a work-around for this particular file. Though now I seem to have a problem with the split function on the lines, but that's another issue. Comma delimited files are common. It would be helpful to be able to read them properly, regardless of content. (Except, of course, if they contain a left paren )
Upgrade to ARC Pro
Your robot can be more than a simple automated machine with the power of ARC Pro!
If you are still having problems please share your code so we can review it.
To avoid rushing a conclusion (quotation marks in other thread), i did a test:
The file content is correct (FileWriteLine OK)
The problem is when you use FileReadLine to read a line with numbers and commas (line 1 content is NOT OK).
It seems a EZ-Script string bug.
a quick workaround, add a space after the comma (line 2 is OK)
Thank you both for your comments.
It may be that adding the space works because doing so added an alpha character to each item. That changed the number to a string of a combination of a number and and an alpha character. Probably get the same results by adding a letter or symbol to each. The space, of course, is the best choice. Naturally that means you have to remove it as you rip off each value in the string (a simple thing to do). Still, it's also a good work around and maintains the comma as a valid delimiter. Thanks for the idea.
when parsing the string ignore the first value e.g. x