1

In RealBasic, is there a way to convert a byte to a string?

Paul Lefebvre
  • 6,253
  • 3
  • 28
  • 36
Marvin
  • 11
  • 1

2 Answers2

1

If you mean turn a Byte into a string representation of the byte in Binary (or hex or Octal), then:

  Dim x As Byte = 24  //For example
  Dim z, y, w As String
  y = Bin(x)      //Binary = "11000"
  z = Hex(x)      //Hexadecimal = "18"
  w = Oct(x)      //Octal = "30"
Andrew Lambert
  • 1,869
  • 1
  • 17
  • 31
0

You could use MemoryBlock:

  Dim m As MemoryBlock
  m = NewMemoryBlock(1)
  m.Byte(0) = 65
  MsgBox(m.StringValue(0, 1)) // Displays "A"

Of course, Chr(65) does the same thing...

Paul Lefebvre
  • 6,253
  • 3
  • 28
  • 36