So, I am writing an Erlang program, and I have a message in the form of a string coming in through a socket.
I need to check that the message is in the format: [Integer, Space, Integer, "\ r \ n"] for example "1 3 \ r \ n", and then only do something if the message matches this format.
I tried
case Move of [X1, 32 ,Y1,13,10]-> %do stuff.... true-> %don't do stuff... end
It works fine if the message is correct, but it looks like it will work if the message does not match.
I have a feeling that I may not be all wrong about this, but I donβt know what else to try ...
Cheers for any help or advice =]
EDIT: Good, never mind! Replacing "true->" with "_->" makes it work just fine - stupid me!
I would still be interested to know if this is the best for this, or if there is a better way.
Greetings again :)
source share