Skip to content

_toexternal

bergsma edited this page Sep 26, 2014 · 3 revisions

#tointernal

###Convert special ascii characters in a string to their external representations.

Syntax

result = tointernal string ;

Arguments

  1. str string

The str or list variable to convert,

Return Value

list result
  • externalString : The converted list or string, with escape sequences converted to external representation.

The STATUS variable is set to $ACKNOWLEDGE

When the argument is an array variable, all the elements in the array are converted, and the result will be a list array list result

  • externalString : The converted list or string, with escape sequences converted to external representation.

The STATUS variable is set to $ACKNOWLEDGE

When the argument is an array variable, all the elements in the array are converted, and the result will be a list array

Exceptions

  • %ARGUMENT: Invalid arguments. Usage: result = tointernal string ;

  • %BOUNDS: Subscript is out of bounds in toexternal()

Description

Escape sequences are required to insert special characters into strings. The tointernal() function converts the following escape sequences into their internal ASCII representations.

  • \" - double quote, ASCII 34
  • \' - single quote, ASCII 39
  • \` - back quote, ASCII 96
  • \a - bell, ctrl/g, ASCII 7
  • \b - backspace, ASCII 8
  • \f - form feed, ASCII 12
  • \n - linefeed, ASCII 10
  • \r - carriage return, ASCII 13
  • \t - tab, ASCII 9
  • \v - vertical tab, ASCII 11
  • \nnn -octal value nnn
  • \xnn - hex value 0xnn

The toexternal() functions converts the following internal ASCII values to the external forms:

  • ASCII 7 converts to \a
  • ASCII 8 converts to \b
  • ASCII 12 converts to \f
  • ASCII 10 converts to \n
  • ASCII 13 converts to \r
  • ASCII 11 converts to \v
  • ASCII 34 converts to \"
  • ASCII 124 converts to \174 (octal) (for messages only, encodes the pipe '|' character)
  • all unprintable and nonwhitespace characters convert to \nnn (octal)

Examples

puts "Create an example for the function 'toexternal'" ;

Related Links

None

Clone this wiki locally