How to convert characters to ascii code?


#1

How to convert characters to ascii code?
computing noob here


#2

Hey @ishankakar

You can convert character to ascii by using Encoding.ASCII.GetBytes(yourString)
it will return a byte array.

For your reference:
Single_char_Ascii_Sample.xaml (5.4 KB)

String_ascii_conversion.xaml (7.1 KB)

Regards…!!
Aksh


#3

Thank you for helping me out


#4

Hi Akshy,
Whatever you have done in above example it’s convert the string into Hexa Value not ascii value. Check the below link.
FYI…
http://onlinecalculators.brainmeasures.com/Conversions/StringtoAsciiCalculator.aspx

Suggest me if i am wrong.


#5

Hey @vivekvivid21

Yeah noticed… There was a little mistake at my end I have put item.Tostring(“X”) so that is why you are getting Hexadecimal values, Due to that Hexadecimal Format Specifier.

So if you will remove X then it will work as expected.

Updating it :slight_smile:

Let me know.

Regards…!!
Aksh


#6

Thanks Man

It’s working fine :slight_smile:

Vivek