Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

Converting Base 02 to Base 10 [help]

[Image: I7SVV.png]

[Image: U5RYg.png]

Here are two algorithms I wrote earlier in the year that you can use. You only asked for the first but you (or anybody else) could make use of the second in the future :p
(Dec 20, 2012 09:12 PM)0xDEAD10CC Wrote:  Perhaps a better structure for functions would be to make them conform to the TryParse() paradigm. I don't see much benefit in making it return an error string when that same returned string value could also be valid output. It just means you'd have to check the output yourself after the fact anyways, which is mainly a waste of time if you already knew at one point that it was invalid.

It's like having one person go to make sure that he took care of something, and then because this person doesn't tell anybody else anything for confirmation, another person always has to come and check after the fact anyways. Not very efficient.

Returning error strings and mixing the return value with good output is bad habit, and also defined in coding practices provided by MSDN.

You did not see the context in which I implemented these functions. I used these functions to return a value to print to a console window. In procedural programming, functions are used to break down code. Rather than creating a long method with ambiguous self-documentation I broke the control in to separate functions which is perfectly acceptable. There is no such thing as a be all end and all design pattern, you know.
[Image: nNeLo.png]

There you go, finally!
Hey HF
Im also have one question about convertation text to hex and revert
Im using this class (pastebin) and its working only with text. When im trying to convert any other symbols, like vbNewline, vbTab etc. im got stuck of output (screenshot)
Spoiler (Click to View)Can anyone help me?


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Java] by +TOASTFeb 16, 2013 02:14 PM 5 247 Feb 16, 2013 02:14 PM
Last Post: MrZander
[Java] by Howard StarkSep 30, 2012 07:27 PM 0 67 Sep 30, 2012 07:27 PM
Last Post: Howard Stark
[C#] by codepoetMar 21, 2010 04:50 PM 4 173 Mar 21, 2010 04:50 PM
Last Post: codepoet