conversion

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Aaron

    #1

    conversion

    Is it possible to convert a hex/ascii string to binary?

    ie.
    Dim s As String
    s = "AA"

    output = Hex2Bin(s) '10101010

    also is there a bin to hex conversion function?


  • Ed Kaim [MSFT]

    #2
    Re: conversion

    Try Convert.ToByte( ), such as:

    Dim s As String

    s = "AA"

    Dim b As Byte

    b = Convert.ToByte( s, 16)



    "Aaron" <kuya789@yahoo. com> wrote in message
    news:OA3JOnI3DH A.1652@TK2MSFTN GP11.phx.gbl...[color=blue]
    > Is it possible to convert a hex/ascii string to binary?
    >
    > ie.
    > Dim s As String
    > s = "AA"
    >
    > output = Hex2Bin(s) '10101010
    >
    > also is there a bin to hex conversion function?
    >
    >[/color]


    Comment

    • phoenix

      #3
      Re: conversion

      The System.Collecti ons.BitArray class takes an array of bytes in its
      constructor and gives you the binary representation.

      Yves

      "Aaron" <kuya789@yahoo. com> schreef in bericht
      news:OA3JOnI3DH A.1652@TK2MSFTN GP11.phx.gbl...[color=blue]
      > Is it possible to convert a hex/ascii string to binary?
      >
      > ie.
      > Dim s As String
      > s = "AA"
      >
      > output = Hex2Bin(s) '10101010
      >
      > also is there a bin to hex conversion function?
      >
      >[/color]


      Comment

      Working...