【问题标题】:Read hex from formcollection convert it into binary从 formcollection 读取十六进制将其转换为二进制
【发布时间】:2014-07-11 03:24:29
【问题描述】:

我认为用户输入十六进制值的控件很少。

以前用户输入字符。我使用的转换

Alert = Convert.ToByte(collection["Alert"])

现在用户想输入十六进制值。

我需要从 fromcollection 中读取以解析用户输入的十六进制值。 然后我需要将该十六进制转换为二进制。

我是编程新手,请指导我。

【问题讨论】:

标签: c# html asp.net asp.net-mvc formcollection


【解决方案1】:

试试这个来自post

使用syste.linq

string binarystring = String.Join(String.Empty,
  hexstring.Select(
    c => Convert.ToString(Convert.ToInt32(c.ToString(), 16), 2).PadLeft(4, '0')
  )
);

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-06-26
    • 1970-01-01
    • 2016-08-28
    • 2013-07-25
    相关资源
    最近更新 更多