[UP]


Manual Reference Pages  - expand (3)

NAME

expand(3f) - [M_strings:NONALPHA] expand C-like escape sequences (LICENSE:PD)

CONTENTS

Synopsis
Description
Examples
Author
License

SYNOPSIS

function expand(line,escape) result(lineout)

   character(len=*)                      :: line
   character(len=1),intent(in),optional  :: escape
   character(len=:),allocatable          :: lineout

DESCRIPTION

EXPAND() expands sequences used to represent commonly used escape sequences or control characters. By default ...

Escape sequences

\ backslash
a alert (BEL) -- g is an alias for a
b backspace
c suppress further output
e escape
f form feed
n new line
r carriage return
t horizontal tab
v vertical tab
oNNN byte with octal value NNN (3 digits)
dNNN byte with decimal value NNN (3 digits)
xHH byte with hexadecimal value HH (2 digits) -- h is an alias for x

The default escape character is the backslash, but this may be changed using the optional parameter ESCAPE.

EXAMPLES

Sample Program:

    program demo_expand
    !  test filter to expand escape sequences in input lines
    use M_strings, only : expand
    character(len=1024) :: line
    integer             :: ios
       READFILE: block
          do
             read(*,’(A)’,iostat=ios)line
             if(ios /= 0) exit READFILE
             write(*,’(a)’)trim(expand(line))
          enddo
       endblock READFILE
    end program demo_expand

Sample input:

     \e[2J
     \tABC\tabc
     \tA\a
     \nONE\nTWO\nTHREE

AUTHOR

John S. Urban

LICENSE

Public Domain


expand (3) March 11, 2021
Generated by manServer 1.08 from 3306f5f6-0f6e-4da0-ab2c-90107e70d78d using man macros.