zoukankan      html  css  js  c++  java
  • 数据解析

    在学习数据解析的时候遇到了问题,记录了下来

    总的来说就是怎么转换的就得怎么去解析。

    1.10进制和16进制的转换

    10进制转换为16进制

    s.tostring("X");

    16进制转换为10进制

    convert.tostring(0xa,10);

    2.16进制转换为字符串

    public string ByteToString(byte[] sendByte)
    {
    string str_data = null;
    for (int i = 0; i < sendByte.Length; i++)
    {
    str_data += (sendByte[i].ToString("X2") + " ");
    }
    return str_data.Trim();

    }

    3.string转换为字节

    如果是单个转换为字节,

    convert.tobyte();

    如果是多个字节

    bitconverter.getbytes();

    如果转换为ascii吗

    encoding.ascii.getbytes();

    4.字节解析出输出

    单个解析

    public string ByteToText(byte[] send)
    {
    for (int i = 0; i < send.Length; i++)
    {
    result += Convert.ToString(send[i], 10) + ".";
    }
    return result;
    }

    多个字节解析

    bitconverter.toint16();

    ASCII码

    enconding.ascii.getstring();

  • 相关阅读:
    (三)数据预处理过程简介
    (二)数据挖掘需要哪些技术
    (一) 什么是数据挖掘?
    怎样提问呢?
    什么是自我意识
    高效能人士的七个习惯
    “U”型读书法
    CMDB学习之一
    层级选择器
    css选择器
  • 原文地址:https://www.cnblogs.com/xiehaha123/p/11678003.html
Copyright © 2011-2022 走看看