3C科技 娛樂遊戲 美食旅遊 時尚美妝 親子育兒 生活休閒 金融理財 健康運動 寰宇綜合

Zi 字媒體

2017-07-25T20:27:27+00:00
加入好友
C# 十進位數字陣列(0~255)轉十六進位CSV字串(00~FF)   using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace CS_Ten2Hex {     class Program     {         static void pause()         {             Console.Write(“Press any key to continue . . . “);             Console.ReadKey(true);         }         static void Main(string[] args)         {             int[] intData = {1, 2, 4, 8, 16, 32, 64, 128, (256-1)};             String StrData = “”;             for (int i = 0; i < intData.Length; i++)             {                 StrData += Convert.ToString(intData[i], 16).ToUpper().PadLeft(2, ‘0’);                 if (i < (intData.Length – 1))                 {                     StrData += “,”;                 }             }             Console.WriteLine(StrData);             pause();         }     } }

本文由jashliaoeuwordpress提供 原文連結

寫了 5860316篇文章,獲得 23313次喜歡
精彩推薦