SpectrixDev/Spectrum

Get Binary to Text working

brahmnw opened this issue · 9 comments

It's pretty annoying when someone tries to do that and goes; "AAAAAAAAAAAAAAAAA LAMEEEEEEEEEEE"

AAAAAAAAAAAAAAAAAAAAAAAAAAA

Firstly: It's not even in this version, and I'm pretty sure it's never been on this repo
Secondly: I'm going to be adding all of that now, loads of text converter things

this isn't even a bug it's just never been a thing, nor is it an issue ;-;
const textToBin = str => str.split('').map(c=>c.charCodeAt(0).toString(2)).join(" ")
console.log(textToBin("lame"))
// "1101100 1100001 1101101 1100101"

There we go. Ohhh, oops, my bad, you guys meant binary to text. I definitely misread that.

const binToText = str => str.split(/[\s,]+/g).map(b=>String.fromCharCode(parseInt(b, 2))).join("")
console.log(binToText("1101100 1100001 1101101 1100101"))
// "lame"

as you can see from above, python is much easier than js.

:)

^

One lang can't be objectively easier than another.

One lang can't be objectively better than another

Ok

I'm closing this because it's not even an issue

I added it here. If there's any actual problems, open up another issue