convert very large string to numeric [message #36124] |
Mon, 25 August 2003 13:58 |
mvukovic
Messages: 63 Registered: July 1998
|
Member |
|
|
Hello,
I have a large two column matrix stored as a string, and I want to
convert it to a two column float matrix.
I've been using a rather convoluted method of flattening out the
string matrix by replacing end-of-lines with spaces (having converted
to byte array first), and then using ParseLine (from David F.'s web
site) to get a vector of numbers:
ByteBuffer = byte(self.CharBuffer)
iSubs = where( (ByteBuffer eq 9b) or $
(ByteBuffer eq 10b) or $
(ByteBuffer eq 13b), cSubs)
if cSubs ne 0 then begin
ByteBuffer[iSubs] = 32b
endif
... etc
However, the ParseLine is rather slow for my large set of numbers. I
suspect the reason is that it uses rather pedestrian and string
oriented methods such as strpos and strmid.
Before I go and re-implement ParseLine by converting the string to a
byte type and using where's to delimit numbers, I was wondering
whether anyone might have done that already.
Thanks,
Mirko
|
|
|