Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / how would you turn a string into a binary to give a decimal number?

Author
Message
HowDo
23
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 23rd Jul 2010 20:24
what! you're thinking is he on about.

I have a string that shows the binary of where something is
eg:
111000101
now the above is stored as a string and I have split it up into three
111 000 101
now I would like the stored string converted to decimal, so that the first 111 comes out as 7.

tried str$(n) but that just gives 111, tried val but that gives the same, val(str$(n)).

if I do this Print %111 it will show 7.

if there not away then I uses what it gives me.

Dark Physics makes any hot drink go cold.
Grog Grueslayer
Valued Member
21
Years of Service
User Offline
Joined: 30th May 2005
Playing: Green Hell
Posted: 23rd Jul 2010 20:36 Edited at: 23rd Jul 2010 20:39
IanMs Matrix 1 Utilities Plugin has a BIN TO DECIMAL command that'll do just that.



If you don't have the plugin yet you can download it here:
http://forum.thegamecreators.com/?m=forum_view&t=85209&b=18

HowDo
23
Years of Service
User Offline
Joined: 28th Nov 2002
Location: United Kingdom
Posted: 23rd Jul 2010 21:24
another one for IanMs to chalk up on the board, Cheers Grog Grueslayer

Dark Physics makes any hot drink go cold.
Kevin Picone
23
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Australia
Posted: 24th Jul 2010 02:51 Edited at: 11th Aug 2010 23:27


Login to post a reply

Server time is: 2026-07-25 05:32:48
Your offset time is: 2026-07-25 05:32:48