[erlang-questions] How to get strings instead of ints out of this code?
Wed May 7 20:50:44 CEST 2008
Jarrod Roberson wrote:
> Erlang (BEAM) emulator version 5.6 [smp:2] [async-threads:0]
> Eshell V5.6 (abort with ^G)
> 1> [A,B|T] = "abcdefg".
> 2> A.
> 3> B.
> 4> T.
> I know _why_ A. and B. print out as ints and why T. prints out as a
> string of characters, how do I get A and B to print out as characters?
Try [A]. There's no such thing as an individual character in Erlang.
Essentially, you have to create a string of 1 character to have
it printed as a character (sort of).
Alternatively, you could just convert it to atom and print:
More information about the erlang-questions