Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and medical aesthetics - How does c# bcd convert strings?
How does c# bcd convert strings?
If you want to realize the function of converting BCD codes into strings in the above code, you can use StringBuilder to build strings.

The specific implementation method is as follows:

Create a StringBuilder object to build the final string.

Traverse the input Int32 array and divide each element into high-order and low-order parts.

The high-order part is converted into characters and added to StringBuilder.

The lower part is converted into characters and added to StringBuilder.

Returns the value of StringBuilder.

Code example:

Common static string WordsToString(Int32[] source)

{

if (source == null)

Returns null

StringBuilder result = new StringBuilder();

Foreach (Int32 i in source code)

{

Result. Add ((char) (I/256));

Result. append((char)(I % 256));

}

Return the results. ToString();

}