expand_html(3f) - [M_unicode:ENCODE] expand HTML character entities ("&NAME;" strings) (LICENSE:MIT)
Synopsis
Description
Options
Returns
Examples
Author
License
pure elemental function expand_html(str) result (string)
type(unicode_type),intent(in),optional :: str ! or character(len=*),intent(in),optional :: strtype(unicode_type) :: string
expand_html(string) returns a copy of the input string with all HTML character entities ( "&NAME;" and "NUMBER;") expanded
str string containing HTML character entities to expand. If STR is not present a table of all the HTML character entity names and the characer they represent and its decimal and hexadecimal value(s) is written to stdout
expand_html copy of the input string with all HTML character entities expanded
Sample program:
program demo_expand_html use iso_fortran_env, only : stdout => output_unit use M_unicode, only : expand_html, unicode_type, assignment(=) use M_unicode, only : ut => unicode_type, operator(==) use M_unicode, only : ch => character implicit none character(len=*),parameter :: g=(*(g0)) integer :: i character(len=*),parameter :: data(*)=[character(len=132) :: & HTML Character Entity Test Page, & Description Entity Entity Rendered , & Name Number Result, & Less than < < <<<, & Greater than > > >>>, & Ampersand & & &&&, & Copyright © © ©©©, & Registered ® ® ®®®, & Trademark ™ ™ ™™™, & Euro € € €€€, & Pound £ £ £££, & Non-breaking space   Before After] do i=1,size(data) write(stdout,g)trim(ch(expand_html(data(i)))) enddo end program demo_expand_htmlExpected output
> HTML Character Entity Test Page > Description Entity Entity Rendered > Name Number Result > Less than < < <<< > Greater than > > >>> > Ampersand & & &&& > Copyright © © ©©© > Registered ® ® ®®® > Trademark ™ ™ ™™™ > Euro € € €€€ > Pound £ £ £££ > Non-breaking space Before After
John S. Urban
