Byte
structureBytes are 8-bit integers as provided by the Word8 structure, but with additional operations over the extended ASCII characters.
signature BYTE
structure Byte
: BYTE
val byteToChar : Word8.word -> char
val charToByte : char -> Word8.word
val bytesToString : Word8Vector.vector -> string
val stringToBytes : string -> Word8Vector.vector
val unpackStringVec : (Word8Vector.vector * int * int option) -> string
val unpackString : (Word8Array.array * int * int option) -> string
val packString : (Word8Array.array * int * substring) -> unit
byteToChar i
charToByte c
bytesToString v
stringToBytes s
Implementation note:
In some implementations, these may be constant-time operations.
unpackStringVec (vec, i, opt)
vec[i..(length vec)-1]
. Raises Subscript if i < 0 or i > length
vec. When opt is SOME n
, unpackStringVec returns the string consisting of characters whose codes are held in vec[i..i+n-1]
. Raises Subscript if i < 0 or n < 0 or i+n > length
vec.
unpackString (arr, i, opt)
unpackStringVec
, but where arr is a Word8Array.array.
packString (arr, i, s)
size
s) + i > length
arr.
WORD, Word8, Word8Vector, Word8Array, Char, String, Substring
Last Modified August 9, 1996
Comments to John Reppy.
Copyright © 1997 Bell Labs, Lucent Technologies