Parsing formatted text

Serge Aleynikov serge@REDACTED
Tue Jul 12 15:08:39 CEST 2005


Refer to io_lib:fread docs:

 > io_lib:fread("TRADE,~d,~d:~d:~d,~f", "TRADE,20040901,00:00:02,15.6").
{ok,[20040901,0,0,2,15.6000],[]}



Joel Reymont wrote:
> I will rephrase a bit... How would you parse the date, time and  numbers 
> in the string below. I understand that I can extract the  fields using 
> binary matching and I'm doing that already.
> 
> I wish there was a version of io:format that read data from a "string".
> 
> On Jul 12, 2005, at 11:27 AM, Joel Reymont wrote:
> 
>> Folks,
>>
>> How would you parse a line like this in Erlang?
>>
>> TRADE,X_._.,20040901,00:00:02,1105.25,,1
> 
> 
> -- 
> http://wagerlabs.com/uptick




More information about the erlang-questions mailing list