Next: getdata() Up: MacAnova Help File Previous: fwrite()   Contents

getascii()

Usage:
getascii(charVec1 [, charVec2 ...]), all arguments CHARACTER vectors



Keywords: character variables
getascii(c), where c is a CHARACTER scalar or quoted string, returns a
REAL vector with integer elements between 1 and 255 inclusive which are
the ASCII codes corresponding to the characters in c.  If c is the null
string "", getascii(c) returns NULL (see 'NULL').

getascii(c1, c2 [, c3 ...]), where all the arguments are CHARACTER
vectors, is equivalent to getascii(paste(c1,c2,..., sep:"")), collapsing
all the elements of all the arguments into one CHARACTER scalar before
decoding.  See paste().

getascii(c) is almost an inverse function to putascii(x,keep:T) in the
sense that getascii(putascii(x,keep:T)) returns x when x is a REAL
vector with integer elements between 1 and 255, and
putascii(getascii(c),keep:T) returns c when CHARACTER scalar c != "".

Examples:
  Cmd> getascii("ABCDE") # ascii code of 'A' is 65, etc.
  (1)           65           66           67           68           69

  Cmd> getascii(vector("AB","C"), "DE") # same as preceding
  (1)           65           66           67           68           69

  Cmd> getascii("\001\002\003\004\005") #or getascii("\1\2\3\4\5")
  (1)            1            2            3            4            5

  Cmd> getascii("\x01\x02\x03\x04\x05") # same as preceding
  (1)            1            2            3            4            5

  Cmd> getascii(putascii(run(30,34),keep:T))
  (1)           30           31           32           33           34

  Cmd> putascii(getascii("MacAnova"),keep:T)
  (1) "MacAnova"

See also putascii().


Gary Oehlert 2003-01-15