<span id="mktg5"></span>

<i id="mktg5"><meter id="mktg5"></meter></i>

        <label id="mktg5"><meter id="mktg5"></meter></label>
        最新文章專題視頻專題問(wèn)答1問(wèn)答10問(wèn)答100問(wèn)答1000問(wèn)答2000關(guān)鍵字專題1關(guān)鍵字專題50關(guān)鍵字專題500關(guān)鍵字專題1500TAG最新視頻文章推薦1 推薦3 推薦5 推薦7 推薦9 推薦11 推薦13 推薦15 推薦17 推薦19 推薦21 推薦23 推薦25 推薦27 推薦29 推薦31 推薦33 推薦35 推薦37視頻文章20視頻文章30視頻文章40視頻文章50視頻文章60 視頻文章70視頻文章80視頻文章90視頻文章100視頻文章120視頻文章140 視頻2關(guān)鍵字專題關(guān)鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
        問(wèn)答文章1 問(wèn)答文章501 問(wèn)答文章1001 問(wèn)答文章1501 問(wèn)答文章2001 問(wèn)答文章2501 問(wèn)答文章3001 問(wèn)答文章3501 問(wèn)答文章4001 問(wèn)答文章4501 問(wèn)答文章5001 問(wèn)答文章5501 問(wèn)答文章6001 問(wèn)答文章6501 問(wèn)答文章7001 問(wèn)答文章7501 問(wèn)答文章8001 問(wèn)答文章8501 問(wèn)答文章9001 問(wèn)答文章9501
        當(dāng)前位置: 首頁(yè) - 科技 - 知識(shí)百科 - 正文

        C#中string與byte[]的轉(zhuǎn)換幫助類-.NET教程,C#語(yǔ)言

        來(lái)源:懂視網(wǎng) 責(zé)編:小采 時(shí)間:2020-11-27 22:45:15
        文檔

        C#中string與byte[]的轉(zhuǎn)換幫助類-.NET教程,C#語(yǔ)言

        C#中string與byte[]的轉(zhuǎn)換幫助類-.NET教程,C#語(yǔ)言:主要實(shí)現(xiàn)了以下的函數(shù) 代碼中出現(xiàn)的sidle是我的網(wǎng)名。 /**//* * @author wuerping * @version 1.0 * @date 2004/11/30 * @description: */ using system; using system.text; namespace sidlehelper { /**/
        推薦度:
        導(dǎo)讀C#中string與byte[]的轉(zhuǎn)換幫助類-.NET教程,C#語(yǔ)言:主要實(shí)現(xiàn)了以下的函數(shù) 代碼中出現(xiàn)的sidle是我的網(wǎng)名。 /**//* * @author wuerping * @version 1.0 * @date 2004/11/30 * @description: */ using system; using system.text; namespace sidlehelper { /**/

         
        主要實(shí)現(xiàn)了以下的函數(shù) 


        代碼中出現(xiàn)的sidle是我的網(wǎng)名。 

        /**//* 
        * @author wuerping 
        * @version 1.0 
        * @date 2004/11/30 
        * @description: 
        */ 
        using system; 
        using system.text; 
        namespace sidlehelper 

        /**//// <summary> 
        /// summary description for strhelper. 
        /// 命名縮寫(xiě): 
        /// str: unicode string 
        /// arr: unicode array 
        /// hex: 二進(jìn)制數(shù)據(jù) 
        /// hexbin: 二進(jìn)制數(shù)據(jù)用ascii字符表示 例 字符1的hex是0x31表示為hexbin是 31 
        /// asc: ascii 
        /// uni: unicode 
        /// </summary> 
        public sealed class strhelper 

        hex與hexbin的轉(zhuǎn)換#region hex與hexbin的轉(zhuǎn)換 
        public static void hexbin2hex(byte[] bhexbin, byte[] bhex, int nlen) 

        for(int i=0; i<nlen/2; i++) 

        if(bhexbin[2*i] <0x41) 

        bhex[i] = convert.tobyte(((bhexbin[2*i] - 0x30)<<4) & 0xf0); 

        else 

        bhex[i] = convert.tobyte(((bhexbin[2*i] - 0x37)<<4) & 0xf0); 

        if(bhexbin[2*i+1] <0x41) 

        bhex[i] |= convert.tobyte((bhexbin[2*i+1] - 0x30) & 0x0f); 

        else 

        bhex[i] |= convert.tobyte((bhexbin[2*i+1] - 0x37) & 0x0f); 



        public static byte[] hexbin2hex(byte[] bhexbin, int nlen) 

        if(nlen%2 !=0) 
        return null; 
        byte[] bhex = new byte[nlen/2]; 
        hexbin2hex(bhexbin, bhex, nlen); 
        return bhex; 

        public static void hex2hexbin(byte[] bhex, byte[] bhexbin, int nlen) 

        byte c; 
        for(int i=0;i<nlen;i++) 

        c = convert.tobyte((bhex[i]>>4) & 0x0f); 
        if(c < 0x0a) 

        bhexbin[2*i] = convert.tobyte(c + 0x30); 

        else 

        bhexbin[2*i] = convert.tobyte(c + 0x37); 

        c = convert.tobyte(bhex[i]&0x0f); 
        if(c < 0x0a) 

        bhexbin[2*i+1] = convert.tobyte(c + 0x30); 

        else 

        bhexbin[2*i+1] = convert.tobyte(c + 0x37); 



        public static byte[] hex2hexbin(byte[] bhex, int nlen) 

        byte[] bhexbin = new byte[nlen*2]; 
        hex2hexbin(bhex, bhexbin, nlen); 
        return bhexbin; 

        #endregion 

        數(shù)組和字符串之間的轉(zhuǎn)化#region 數(shù)組和字符串之間的轉(zhuǎn)化 
        public static byte[] str2arr(string s) 

        return (new unicodeencoding()).getbytes(s); 

        public static string arr2str(byte[] buffer) 

        return (new unicodeencoding()).getstring(buffer, 0, buffer.length); 

        public static byte[] str2ascarr(string s) 

        return system.text.unicodeencoding.convert(system.text.encoding.unicode, 
        system.text.encoding.ascii, 
        str2arr(s)); 

        public static byte[] str2hexascarr(string s) 

        byte[] hex = str2ascarr(s); 
        byte[] hexbin = hex2hexbin(hex, hex.length); 
        return hexbin; 

        public static string ascarr2str(byte[] b) 

        return system.text.unicodeencoding.unicode.getstring( 
        system.text.asciiencoding.convert(system.text.encoding.ascii, 
        system.text.encoding.unicode, 
        b) 
        ); 

        public static string hexascarr2str(byte[] buffer) 

        byte[] b = hex2hexbin(buffer, buffer.length); 
        return ascarr2str(b); 

        #endregion 


        聲明:本網(wǎng)頁(yè)內(nèi)容旨在傳播知識(shí),若有侵權(quán)等問(wèn)題請(qǐng)及時(shí)與本網(wǎng)聯(lián)系,我們將在第一時(shí)間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

        文檔

        C#中string與byte[]的轉(zhuǎn)換幫助類-.NET教程,C#語(yǔ)言

        C#中string與byte[]的轉(zhuǎn)換幫助類-.NET教程,C#語(yǔ)言:主要實(shí)現(xiàn)了以下的函數(shù) 代碼中出現(xiàn)的sidle是我的網(wǎng)名。 /**//* * @author wuerping * @version 1.0 * @date 2004/11/30 * @description: */ using system; using system.text; namespace sidlehelper { /**/
        推薦度:
        標(biāo)簽: net 的轉(zhuǎn)換 c#
        • 熱門(mén)焦點(diǎn)

        最新推薦

        猜你喜歡

        熱門(mén)推薦

        專題
        Top
        主站蜘蛛池模板: 精品香蕉在线观看免费| 欧美亚洲国产SUV| 亚洲激情中文字幕| 亚洲国产成人片在线观看无码 | 国产又黄又爽胸又大免费视频| 免费无码又爽又刺激网站| 无码人妻AV免费一区二区三区| 免费人妻无码不卡中文字幕系| 最近中文字幕mv免费高清视频7| 无码国模国产在线观看免费| 亚洲精品成a人在线观看| 亚洲精品无码av人在线观看| 亚洲一区二区三区乱码在线欧洲| 青草青草视频2免费观看| 97公开免费视频| 亚洲精品视频久久久| 亚欧洲精品在线视频免费观看 | 日本在线高清免费爱做网站| 国产一级淫片免费播放| 亚洲毛片免费视频| 岛国岛国免费V片在线观看| 国产黄色一级毛片亚洲黄片大全 | 18禁成年无码免费网站无遮挡| 久久久无码精品亚洲日韩软件| 亚洲av片不卡无码久久| 中国一级毛片视频免费看| 亚洲高清国产AV拍精品青青草原| **俄罗斯毛片免费| 亚洲人成在线播放网站| 国产亚洲综合久久| 97免费人妻无码视频| 亚洲AV无码国产剧情| 亚洲午夜AV无码专区在线播放| 精品在线免费观看| 亚洲综合色自拍一区| 鲁啊鲁在线视频免费播放| 国产成人亚洲综合无码精品| 国产a视频精品免费观看| 亚洲AV本道一区二区三区四区| 久久一区二区免费播放| 亚洲国产一成久久精品国产成人综合|