LOWER(3f) - [M_unicode:CASE] changes a string to lowercase over specified range (LICENSE:MIT)
Synopsis
Description
Options
Returns
Trivia
Examples
Author
License
pure elemental function lower(str) result (string)
character(*), intent(in) :: str character(len(str)) :: string ! output string
lower(str) returns a copy of the input string with all characters converted to miniscule (ie. "lowercase").
str string to convert to miniscule
lower copy of the entire input string with all characters converted to miniscule.
The terms "uppercase" and "lowercase" date back to the early days of the mechanical printing press. Individual metal alloy casts of each needed letter or punctuation symbol were meticulously added to a press block, by hand, before rolling out copies of a page. These metal casts were stored and organized in wooden cases. The more-often-needed miniscule letters were placed closer to hand, in the lower cases of the work bench. The less often needed, capitalized, majuscule letters, ended up in the harder to reach upper cases.
Sample program:
program demo_lower use iso_fortran_env, only : stdout => output_unit use M_unicode, only : lower, unicode_type, assignment(=), trim use M_unicode, only : ut => unicode_type, operator(==) implicit none character(len=*),parameter :: g=(*(g0)) type(unicode_type) :: pangram type(unicode_type) :: diacritics type(unicode_type) :: expected ! ! a sentence containing every letter of the English alphabet pangram="THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG" expected="the quick brown fox jumps over the lazy dog" call test(pangram,expected) ! ! Slovak pangram PANGRAM = VYPÄTÁ DCÉRA GRÓFA MAXWELLA S IQ NIŽŠÍM AKO & &KÔŇ NÚTI ČEĽAĎ HRÝZŤ HŔBU JABĹK. expected = vypätá dcéra grófa maxwella s iq nižším ako & &kôň núti čeľaď hrýzť hŕbu jabĺk. call test(pangram,expected) ! ! contains each special Czech letter with diacritics exactly once DIACRITICS=PŘÍLIŠ ŽLUŤOUČKÝ KŮŇ ÚPĚL ĎÁBELSKÉ ÓDY. expected =příliš žluťoučký kůň úpěl ďábelské ódy. print g,("A horse that was too yellow-ish moaned devilish odes") call test(diacritics,expected) contains subroutine test(in,expected) type(unicode_type),intent(in) :: in type(unicode_type),intent(in) :: expected type(unicode_type) :: lowercase character(len=*),parameter :: nl=new_line(A) write(stdout,g)in%character() lowercase=lower(in) write(stdout,g)lowercase%character() write(stdout,g)merge(PASSED,FAILED,lowercase == expected ),nl end subroutine test end program demo_lowerExpected output
> THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG > the quick brown fox jumps over the lazy dog > PASSED > > VYPÄTÁ DCÉRA GRÓFA MAXWELLA S IQ NIŽŠÍM AKO KÔŇ NÚTI ... > ČEĽAĎ HRÝZŤ HŔBU JABĹK. > vypätá dcéra grófa maxwella s iq nižším ako kôň núti ... > čeľaď hrýzť hŕbu jabĺk. > PASSED > > ("A horse that was too yellow-ish moaned devilish odes") > PŘÍLIŠ ŽLUŤOUČKÝ KŮŇ ÚPĚL ĎÁBELSKÉ ÓDY. > příliš žluťoučký kůň úpěl ďábelské ódy. > PASSED
John S. Urban
