[UP]


Manual Reference Pages  - adjustc (3)

NAME

adjustc(3f) - [M_strings:WHITESPACE] center text (LICENSE:PD)

CONTENTS

Synopsis
Description
Options
Returns
Examples
Author
License

SYNOPSIS

pure function adjustc(string[,length])

   character(len=*),intent(in)  :: string
   integer,intent(in),optional  :: length
   character(len=:),allocatable :: adjustc

DESCRIPTION

Centers input text in a string of the length specified. Returns a string of length LENGTH if LENGTH is present. Otherwise returns a string of the length of the input string.

OPTIONS

string input string to trim and center
length line length to center text in, optional.

RETURNS

adjustc
  centered output string

EXAMPLES

Sample Program:

   program demo_adjustc
   use M_strings, only : adjustc
   !  using length of the input string
      write(*,’(a)’)       ’================================’
      write(*,’(a)’)adjustc(’centered string                 ’)
      write(*,’(a)’)adjustc(’                 centered string’)
      write(*,’(a)’)adjustc(’  centered string               ’)
   !  using explicit output string length
      write(*,’(a)’)repeat(’=’,50)
      write(*,’(a)’)adjustc(’this is a centered string’,50)
      write(*,’(a)’)repeat(’=’,50)
   end program demo_adjustc

Expected output

   ================================
           centered string
           centered string
           centered string
   ==================================================
               this is a centered string
   ==================================================

AUTHOR

John S. Urban

LICENSE

Public Domain


adjustc (3) March 11, 2021
Generated by manServer 1.08 from 45b379b2-6811-49a8-a9bd-451a566b0e3d using man macros.