I'm looking for a decimal to alphanumeric number base converter library in Visual Basic that does not use recursion.
I found: http://visualstudiomagazine.com/articles/2010/07/20/when-hexadecimal-is-not-enough.aspx
which includes a demo app but discovered that it uses recursion. The problem with it using recursion became apparent when I attempted to integrate the library into my own Visual Studio Express 2010 Visual Basic project: I got a stack overflow exception.
Now I could consider increasing the size memory allocated for the stack but it might be hard to determine what this would be, given that the recursion depth might vary depending on the value to be converted.
My situation requires a reliable deterministic solution so I would prefer to discount the idea of using recursion.
I shall do more research and endeavour to write the algorithm from scratch but would rather not re-invent the wheel if it already exists so hence this question. A search on here did not quite give me what I was looking for.
Can you point me in the direction of an existing non-recursive decimal to alphanumeric converter library in Visual Basic?
This solution I provide myself appears to work - so simple too! But that's because it is a one-way conversion; the other libraries aim to be two-way conversion, back and forth between difference bases - but I don't need both ways.
I created the above code in Visual Basic based on the C# code in the following link:
CREDIT: http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/5babf71f-4375-40aa-971a-21c1f0b9762b/ ("convert from decimal(base-10) to alphanumeric(base-36)")
@assylias I couldn't get devx.com/vb2themax/Tip/19316 to work - I got the wrong value back. Thanks though for the suggestion.
There is no evidence that it works. I adjusted some declarations and superficial structure of the code to get it to build successfully in Visual Studio Express 2010 Visual Basic. Then stepped through the code in the Visual Studio Express 2010 Visual Basic debugger, the code is hard to follow: variable names not obvious, no comments as to why it is doing what it is doing. From what I understood it was doing, it did not seem like it should be doing that to do the base conversion.