Manual Reference Pages  - reverse (3m_unicode)

NAME

reverse(3f) - [M_unicode:CASE] reverse order of glyphs on a line (LICENSE:MIT)

CONTENTS

Synopsis
Description
Options
Returns
Examples
Author
License

SYNOPSIS

impure elemental function reverse(str) result (string)

     type(unicode_type),intent(in) :: str
     type(unicode_type)            :: string

DESCRIPTION

reverse(string) returns a copy of the input string with all characters in reverse position on the line.

OPTIONS

str string to reverse

RETURNS

reverse
  copy of the input string with order of characters on the line reversed.

EXAMPLES

Sample program:

   program demo_reverse
   use iso_fortran_env, only : stdout => output_unit
   use M_unicode,       only : reverse, ch=>character
   use M_unicode,       only : unicode_type, assignment(=)
   use M_unicode,       only : ut => unicode_type, operator(==)
   implicit none
   character(len=*),parameter :: g=’(g0)’
   type(unicode_type)         :: original(3)
      original(1)=’abcde’
      original(2)=’한국말’
      original(3)=’五十七’
      write(stdout,g)ch(original)
      write(stdout,*)
      write(stdout,g)ch(reverse(original))
   end program demo_reverse

Expected output

  > abcde
  > 한국말
  > 五十七

> edcba > 말국한 > 七十五

AUTHOR

John S. Urban

LICENSE

    MIT