2-based, 8-based, 10 credit, 16-en-en-en-enabled conversion (C #)

xiaoxiao2021-03-06  118

In the .NET Framework, the SYSTEM.CONVERT class provides a comprehensive conversion function between various types and values. Two methods of these methods can easily implement the conversions between various enrunters: Convert.Toint32 (string value, int.combase): You can convert different credits strings to numbers, where the FROSE parameter is Format, can only be 2, 8, 10 and 16: such as Convert.TOINT32 ("0010", 2) The result is 2; convert.toString (int value, int tobase): You can convert a number to different envelopes Value string format, where the ToBase parameter is a format, which can only be 2, 8, 10, and 16: as the result of Convert.TOSTRING (2, 2) is "0010" now we do a way to implement various The string free conversion: select it into a numeric shape, then turn it into a corresponding enrichment string: public string convertString (String Value, int around, int tobase) {int INTVALUE = Convert.ToinT32 Value, frombase; Return Convert.TOSTRING (INTVALUE, TOBASE);} where frombase is the original format TOBASE is the format that will be converted into

Yolle [

original]

Author Blog: http://blog.9cbs.net/yolle/

转载请注明原文地址:https://www.9cbs.com/read-126649.html

New Post(0)