[UP]


Manual Reference Pages  - lenset (3)

NAME

lenset(3f) - [M_strings:LENGTH] return string trimmed or padded to specified length (LICENSE:PD)

CONTENTS

Synopsis
Description
Options
Results
Example
Author
License

SYNOPSIS

function lenset(str,length) result(strout)

    character(len=*)                     :: str
    character(len=length)                :: strout
    integer,intent(in)                   :: length

DESCRIPTION

lenset(3f) truncates a string or pads it with spaces to the specified length.

OPTIONS

str input string
length output string length

RESULTS

strout output string

EXAMPLE

Sample Program:

    program demo_lenset
     use M_strings, only : lenset
     implicit none
     character(len=10)            :: string=’abcdefghij’
     character(len=:),allocatable :: answer
        answer=lenset(string,5)
        write(*,’("[",a,"]")’) answer
        answer=lenset(string,20)
        write(*,’("[",a,"]")’) answer
    end program demo_lenset

Expected output:

    [abcde]
    [abcdefghij          ]

AUTHOR

John S. Urban

LICENSE

Public Domain


lenset (3) March 11, 2021
Generated by manServer 1.08 from ef31d599-c76c-459a-a8d0-4104049dd9d5 using man macros.