pound_to_box(3f) - [M_unicode:EDITING] convert pound character to box characters (LICENSE:MIT)
Synopsis
Characteristics
Description
Options
Returns
Examples
Author
License
syntax:
function pound_to_box(win,style) result(winout)type(unicode_type)|character(len=*),intent(in) :: win(:) type(unicode_type)|character(len=*),intent(in),optional :: style type(unicode_type),allocatable :: winout(:)
o WINOUT elements will all have the length of the longest element of WIN
The pound character ("#") may be used to construct boxed text with the restriction that lines must be seperated by at least one character from other lines.
win input array to be changed style may be "light", "bold", or "double". Default is "bold".
winout an array of strings with box characters substituted for adjacent pound characters.
Sample Program:
program demo_pound_to_box use M_unicode, only : ut=>unicode_type use M_unicode, only : operator(//) use M_unicode, only : assignment(=) use M_unicode, only : character, pound_to_box implicit none type(ut),allocatable :: textout(:) character(len=*),parameter :: text(*)=[character(len=80) :: & ############################################, & #abcdefg# What about # # # #, & #hijklmn# this text? # # ######, & ############################### # #, & # # # # ######, & # # # # # #, & ############################################, & , & ###################################, & # WARNING, WARNING, Will Robinson #, & ###################################] textout=text call write_text() textout=pound_to_box(text) call write_text() textout=pound_to_box(text,style=light) call write_text() textout=pound_to_box(text,style=double) call write_text()Results:contains subroutine write_text() integer :: i write(*,(*(a:)),advance=no) & & (trim(textout(i)%character()), & & new_line(a), & & i=1,size(textout)) end subroutine write_text
end program demo_pound_to_box
> ############################################ > #abcdefg# What about # # # # > #hijklmn# this text? # # ###### > ############################### # # > # # # # ###### > # # # # # # > ############################################ > > ################################### > # WARNING, WARNING, Will Robinson # > ################################### > ┏━━━━━━━┳━━━━━━━━━━━━┳━━━━━━━━┳━━━━━━━┳━━━━┓ > ┃abcdefg┃ What about ┃ ┃ ┃ ┃ > ┃hijklmn┃ this text? ┃ ┃ ┣━━━━┫ > ┣━━━━━━━┻━━━━━━┳━━━━━╋━━━━━━━━┫ ┃ ┃ > ┃ ┃ ┃ ┃ ┣━━━━┫ > ┃ ┃ ┃ ┃ ┃ ┃ > ┗━━━━━━━━━━━━━━┻━━━━━┻━━━━━━━━┻━━━━━━━┻━━━━┛ > > ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ > ┃ WARNING, WARNING, Will Robinson ┃ > ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ > ┌───────┬────────────┬────────┬───────┬────┐ > │abcdefg│ What about │ │ │ │ > │hijklmn│ this text? │ │ ├────┤ > ├───────┴──────┬─────┼────────┤ │ │ > │ │ │ │ ├────┤ > │ │ │ │ │ │ > └──────────────┴─────┴────────┴───────┴────┘ > > ┌─────────────────────────────────┐ > │ WARNING, WARNING, Will Robinson │ > └─────────────────────────────────┘ > ╔═══════╦════════════╦════════╦═══════╦════╗ > ║abcdefg║ What about ║ ║ ║ ║ > ║hijklmn║ this text? ║ ║ ╠════╣ > ╠═══════╩══════╦═════╬════════╣ ║ ║ > ║ ║ ║ ║ ╠════╣ > ║ ║ ║ ║ ║ ║ > ╚══════════════╩═════╩════════╩═══════╩════╝ > > ╔═════════════════════════════════╗ > ║ WARNING, WARNING, Will Robinson ║ > ╚═════════════════════════════════╝
John S. Urban
