[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) July 05, 2020
Generated by manServer 1.08 from 575a855c-485f-4bf0-9886-5b57fe5fd962 using man macros.