String to ASCII code stringtoascii
The called function is:Stringtoascii. parseascii (s)
Public Class Stringtoascii { Private Static String tohexutil ( Int N) {string RT = "" ; Switch (N ){ Case 10: RT + = ""; Break ; Case 11: RT + = "B "; Break ; Case 12: RT + = "C "; Break ; Case 13: RT + = "D "; Break ; Case 14: RT + = "E "; Break ; Case 15: RT + = "F "; Break ; Default : RT + = N ;} Return RT ;} Public Static String tohex ( Int N) {stringbuilder sb = New Stringbuilder (); If (N/16 = 0 ){ Return Tohexutil (n );} Else {String t = Tohex (N/16 ); Int Nn = n % 16 ; Sb. append (T). append (tohexutil (NN ));} Return SB. tostring ();} Public Static String parseascii (string Str) {stringbuilder sb = New Stringbuilder (); Byte [] BS = Str. getbytes (); For ( Int I = 0; I <BS. length; I ++ ) Sb. append (tohex (BS [I]); Return SB. tostring ();} Public Static Void Main (string ARGs []) {string s = "XYZ" ; System. Out. println ( "The converted string is:" + stringtoascii. parseascii (s) ;}