C Library Functions - lenset (3)
NAME
lenset(3f) - [M_strings:LENGTH] return string trimmed or padded to
specified length
(LICENSE:PD)
CONTENTS
Synopsis
Description
Options
Returns
Examples
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
|
|
RETURNS
EXAMPLES
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
| Nemo Release 3.1 | lenset (3) | June 29, 2025 |
Generated by manServer 1.08 from 786e32b2-c7f4-4b1a-bf1c-3481338743e8 using man macros.