Binary-to-number

I’m using Javascript, and I have a binary number stored as a string that I need to convert to the number it represents, and I’ve tried researching this but I haven’t found an answer that works. The binary figure is 32 bits long so there’s alot of potential answers, I need a function that can do this for me on the fly.

I’m curious how researching could have not come up with pages full of useful techniques.

I forgot to mention I’m using Javascript. I haven’t found alot about converting binary to numbers with Javascript, and nothing I’ve tried has worked.

What language you use doesn’t matter; you’re still using .NET (or rather Mono) and the same functions are available and work the same way. Going from the link StarManta posted, this works perfectly fine.

As a hint, it’s usually pointless googling for Javascript solutions because you mostly end up with web Javascript, which doesn’t apply to Unity. Just search for “C# [insert keywords here]” and convert the syntax to Unityscript where necessary.

–Eric