search
尋找貓咪~QQ 地點 桃園市桃園區 Taoyuan , Taoyuan

C# 十進位數字陣列(0~255)轉十六進位CSV字串(00~FF) – jashliao部落格

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 提供 原文連結

寵物協尋 相信 終究能找到回家的路
寫了7763篇文章,獲得2次喜歡
留言回覆
回覆
精彩推薦