473,804 Members | 2,124 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Converting integer to hex string

Dan
Does C# provide a function for converting an integer to a hex string?
Nov 15 '05 #1
2 54485
Hi,

yes it does,

eg
int a = 123;
a.ToString("X8" ); for 8 hex characters

Greetings,

Bram

"Dan" <da*@dontspamme .com> wrote in message
news:et******** ******@TK2MSFTN GP10.phx.gbl...
Does C# provide a function for converting an integer to a hex string?

Nov 15 '05 #2
Dan
Thanks. It sure was hard to find that in the documentation. I did all
these searches on "integer" "convert" "hex" and came up blank.

"Bram" <bv*****@nospam .skynet.be> wrote in message
news:40******** *************@n ews.skynet.be.. .
Hi,

yes it does,

eg
int a = 123;
a.ToString("X8" ); for 8 hex characters

Greetings,

Bram

"Dan" <da*@dontspamme .com> wrote in message
news:et******** ******@TK2MSFTN GP10.phx.gbl...
Does C# provide a function for converting an integer to a hex string?


Nov 15 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
5573
by: Peter Warder | last post by:
I'm still struggling with these conversions! The wider code is working well but I can't get the compiler to accept my attempts at converting Integers (back) into Strings. What's the trick? TIA Peter / London
6
2771
by: Alex Neumann | last post by:
Hi, I need a function which converts an string to an integer. Currently I have this: bool string2int(char* digit, int& result) { result = 0; if (!(*digit >= '0' && *digit <='9'))
6
11971
by: John | last post by:
Hi I would like to convert a number to string but with a preceding zero if the number is less than 10. How can I accomplish this? Thanks Regards
13
3660
by: coinjo | last post by:
Is there any function to determine the length of an integer string?
1
1923
by: Kevin S Gallagher | last post by:
I found this code (pretty sure it was from a MVP) for converting a string variable to a form object which works fine within a form. Take the code and place it into a code module and it fails on the second line in regards to Me.GetType.... any idea how to get this to work outside of a form? Dim strClass As String = Reflection.Assembly.GetExecutingAssembly.GetName.Name & ".frmChildOne" Dim tyOfStringVariable As Type =...
1
1963
by: Stile213 | last post by:
What's the easiest way to input an integer string using the cin function? The string will be single digits and from 1 to 5 elements long.
0
1374
by: rrp83 | last post by:
Hi All Can anyone fwd me the code for converting a string to bytes similar to the GetBytes function in C# and viceversa?? Regards, RRP83
2
4011
by: CoreyWhite | last post by:
Problem: You have numbers in string format, but you need to convert them to a numeric type, such as an int or float. Solution: You can do this with the standard library functions. The functions strtol, strtod, and strtoul, defined in <cstdlib>, convert a null- terminated character string to a long int, double, or unsigned long. You can use them to convert numeric strings of any base to a numeric
13
1788
by: Pierre Quentel | last post by:
Hi, I would like to know if there is a module that converts a string to a value of the "most probable type" ; for instance : - if the string is "abcd" the value is the same string "abcd" - string "123" : value = the integer 123 - string "-1.23" (or "-1,23" if the locale for decimals is ,) : value = the float -1.23 - string "2008/03/06" (the format is also locale-dependant) : value = datetime.date(2008,03,06)
0
9716
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9595
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10604
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10354
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10359
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10101
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
4314
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3837
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3005
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.