Binary Alphabet: The Alphabet Letters in Binary
4 stars based on
Here I sit, a million miles from Home, trying to find something to write about that is semi-useful but cool at the same time. My first inclination and subject I wrote about was actually bitwise operators and number representation in binary. I know, compelling right?
While I did write about that, I chose something else for this first post. However, I was recently inspired to write about something I saw in the movie The Martian.
As a side note, I feel that Matt Damon is one of the best Hollywood has to offer. But since this is a technical blog post, I will spare you the details on that. So we have this man who is million miles or million km for those of you who use the Metric System from Home. This is of course when Earth and Mars are in opposition and at aphelion. He is all alone and has no way to communicate with the ones he loves.
After a while, he remembers that there is an old rover robot that was left on Mars from a previous mission. The Martian is able to find this robot and, after some re-engineering, use it to communicate with Home.
However, because of the limitations of this robot it is not a walkie-talkiehe has to use ASCII decimal to hexidecimal conversion. I am not sure if I would have thought of this myself but what a brilliant idea.
So in the interest of being able to sing the praises of the technical consultants of The Martian and Matt Damonthis is the subject of my post. As a starting point we will go with the standard English alphabet and how it is represented in number form.
While I am imagining that the Martian had no need to distinguish uppercase from lower, I will be using both. If welcome to binary alphabet converter we all spoke in numbers, right? For that we will be using the String. This method is on the String global object and can be welcome to binary alphabet converter to create strings directly with a given input.
In this case, we are inputting the ASCII codes and getting back the letters that correspond with them. The first thing to note about hexadecimal hex for short is that each letter in hex is represented by either two numbers or a number and a letter.
These representations are 0 — 9 and a — f. This means hopefully in lay-mans terms that the hex system is a base 16 system. Meaning that there are only sixteen possible characters to use when representing letters. If this is confusing, allow me to clear it up. Once you have all of the Welcome to binary alphabet converter number representations of your letters, you welcome to binary alphabet converter need to do a little math to complete the hex conversion.
Next, we need to get the remainder of that division which is 1. Well, this is where it comes in to play. With that remainder we will use that base 16 to get the second character in our hex representation. One more small thing to note is that we will only use the zero 0 if we get no remainder from our division. Because there are twenty six letters in the standard English alphabet, the arc radius approximately Converting those letters to hexidecimal code would allow for a wider arc I know it seems painstaking but with nothing to do but figure out how to get back Home, the process is well worth it for this Martian.
So on to the part that does all the work for you. This next one does the entire conversion for you. It starts with a string and uses the String. The test cases I used were to figure out the welcome to binary alphabet converter of our division to reference the base16 string variable to get the second character of our hex.
Besides, a major component to programming is communication and while some of welcome to binary alphabet converter can just pick up a phone, imagine if you were trapped on a distant planet with nothing but an welcome to binary alphabet converter robot.
At the very least, you can use this to call Home. So from Mars, thank you for listening.