Binaries - pattern matching
Vance Shipley
vances@REDACTED
Wed Mar 5 23:57:05 CET 2003
1> L = [1,2,3,4,5,6,7,8,9,10,11,12,13].
[1,2,3,4,5,6,7,8,9,10,11,12,13]
2> LB = list_to_binary(L).
<<1,2,3,4,5,6,7,8,9,10,11,12,13>>
3> <<A:10/binary, B:3/unit:8>> = LB.
<<1,2,3,4,5,6,7,8,9,10,11,12,13>>
4> A.
<<1,2,3,4,5,6,7,8,9,10>>
5> B.
723981
6> <<First:8, Second:8, Third:8, Fourth:8, Fifth:8, Sixth:8, Seventh:8, Eighth:8, Ninth:8, Tenth:8>> = A.
<<1,2,3,4,5,6,7,8,9,10>>
10> First.
1
11> Second.
2
12> Third.
3
On Wed, Mar 05, 2003 at 03:30:17PM +0100, Inswitch Solutions - Erlang Evaluation wrote:
}
} I have executed the following commands in the Erlang shell:
} 1) L = [1,2,3,4,5,6,7,8,9,10,11,12,13].
} 2) LB = list_to_binary(L).
} 3) <<A:10/unit:8, B:3/unit:8>> = LB.
} 4) A.
} 5) 4759477275222530853130
}
} Please, does anyone know what type is 'A' variable ?
} 'A' variable contains 10 bytes, how can I retrieve each byte from it?
}
}
} Thanks,
} Eduardo Figoli
} INSwitch Solutions.
}
More information about the erlang-questions
mailing list