none
convert from decimal(base-10) to alphanumeric(base-36) RRS feed

  • Question

  • I need to do a program by console, for convert a number base 10 to base 36, I tried to search and I found that one: https://social.msdn.microsoft.com/Forums/vstudio/en-US/5babf71f-4375-40aa-971a-21c1f0b9762b/convert-from-decimalbase10-to-alphanumericbase36?forum=csharpgeneral,

    but this dosn't help me, I need to copy it and paste it, because I'm new in C# and I need the program for my teacher, anyone can do it and explain it? 

    Tuesday, December 5, 2017 8:20 AM

All replies

  •  private static string ToBase36(ulong value)
            {
                const string base36 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
                var sb = new StringBuilder(13);
                do
                {
                    sb.Insert(0, base36[(byte)(value % 36)]);
                    value /= 36;
                } while (value != 0);
                return sb.ToString();
            }


    Ashish Pandey

    Tuesday, December 5, 2017 10:16 AM
  • Hello ChristopherCC,

    Few days ago I have met the question need to be solved by conversion base-10 and base-36. You will find what you want in the below link.

    https://social.msdn.microsoft.com/Forums/vstudio/en-US/8a396bc7-4a82-4831-8b4d-bce272068246/

    As for how to understand it, you will find a lot of explanation in the internet as long as you do some search job. And there is a good explanation about converting from decimal to hexadecimal.

    https://www.wikihow.com/Convert-from-Decimal-to-Hexadecimal

    Best regards,

    Neil Hu

    Note: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; Therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, December 6, 2017 6:41 AM
    Moderator
  • You should not ask us to do your homework for you.  The correct procedure would be for you to show us what you had done, then explain what you expected and what it actually did.  We can then guide you to a correct program.  Supplying the complete answer, as Ashish did, is cheating.

    Tim Roberts, Driver MVP Providenza & Boekelheide, Inc.

    Wednesday, December 6, 2017 10:20 PM
  • Hello ChristopherCC,

    Is there any update or any other assistance I could provide? You could mark the helpful reply as answer if the issue has been solved. And if you have any concerns, please do not hesitate to let us know.

    Thank you for your understanding and patience!

    Best regards,

    Neil Hu


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Sunday, December 24, 2017 7:43 AM
    Moderator