Today I Learned

hashrocket A Hashrocket project

Binary Representation Of A String

A common trick in Elixir is to concatenate the null byte <<0>> to a string to see its inner binary representation.

A couple example of this can be seen in the following snippet of code:

> "hello" <> <<0>>
<<104, 101, 108, 108, 111, 0>>
> "ƒå®øü†" <> <<0>>
<<198, 146, 195, 165, 194, 174, 195, 184, 195, 188, 226, 128, 160, 0>>

source

See More #elixir TILs
Looking for help? At Hashrocket, we 💜 Elixir! From our many Elixir client projects, to sponsoring the Chicago Elixir Meetup, to the source code for this application, we are invested in this community. Contact us today to talk about your Elixir project.