adjustc(3f) - [M_strings:WHITESPACE] center text (LICENSE:PD)
Synopsis
Description
Options
Returns
Examples
Author
License
pure function adjustc(string[,length])
character(len=*),intent(in) :: string integer,intent(in),optional :: length character(len=:),allocatable :: adjustc
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.
string input string to trim and center length line length to center text in, optional.
adjustc centered output string
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_adjustcExpected output
================================ centered string centered string centered string ================================================== this is a centered string ==================================================
John S. Urban
Public Domain
Nemo Release 3.1 | adjustc (3m_strings) | January 10, 2025 |