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
v!
ec.
unpackString (arr, i, opt)
unpackStringVec
, but where arr is a Word8Array.array.
packString (s, arr, i)
size
s) + i > length
arr.
WORD, Word8, Word8Vector, Word8Array, Char, String, Substring
Last Modified August 9, 1996
Copyright © 1996 AT&T