Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - How does c# realize the conversion of plastics to 16? What are the methods?
How does c# realize the conversion of plastics to 16? What are the methods?
int a = 15 .

The hexadecimal value of each character in the output string.

Parse the string into an array of characters, and then call ToInt32(Char) for each character to get the corresponding value. Finally, set the number format to hexadecimal representation in string.

string input = "Hello World!" ;

Char[] value = input. ToCharArray();

Foreach (character in value)

{//Gets the integer value of the character.

Int value = Convert. ToInt32 (letter);

//Converts a decimal value to a hexadecimal value in the form of a string.

String hexOutput = string. Format ("{0:X}", value);

Console. WriteLine ("Hex value {0} is {1}", letter, hexoutput); } 。