-
Re: Convert Integer to 2-base, 8-base string?
"David Chu" <chud@hotmail.com> wrote in message
news:3ea56e15$1@tnews.web.devx.com...
>
> By using the following statement, I can convert an integer to a hexdecimal
> string:
>
> string sMyHex = string.format("{0:x}", 12345);
>
> I could not find a similar way to convert an integer to a 2 or 8 based
string.
> For example,
>
> 2 -> "10" (2-based)
> 8 -> "10" (8-based)
>
> Is there any function to do the conversion?
>
> Thanks for any help!
>
> D. Chu
Console.WriteLine(Convert.ToString(2, 2));
Console.WriteLine(Convert.ToString(8, 2));
HTH,
Tom Shelton
-
Convert Integer to 2-base, 8-base string?
By using the following statement, I can convert an integer to a hexdecimal
string:
string sMyHex = string.format("{0:x}", 12345);
I could not find a similar way to convert an integer to a 2 or 8 based string.
For example,
2 -> "10" (2-based)
8 -> "10" (8-based)
Is there any function to do the conversion?
Thanks for any help!
D. Chu
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks