[erlang-questions] segments of variable length

Gamoto gamoto@REDACTED
Fri Apr 3 12:14:25 CEST 2009

I receive from several machines messages and I would like to extract data.
My first approach was:

	case Data of 

My problem is that some segment have a fixed length (header, Status) and some others a variable length (Time <= 6 bytes, UnitID <= 8 bytes).
My approach is bad. I thought to do:      Segments = string:tokens(Data,",") 
This separates the segments but I don't have their name (header,unitid,time,status) !
Could you advice me a better approach. My goal is to check each segment and make actions according to their values.

More information about the erlang-questions mailing list