QR_MUMPS
qrm_string_mod.F90
Go to the documentation of this file.
1 !! ##############################################################################################
2 !!
3 !! Copyright 2012 CNRS, INPT
4 !!
5 !! This file is part of qr_mumps.
6 !!
7 !! qr_mumps is free software: you can redistribute it and/or modify
8 !! it under the terms of the GNU Lesser General Public License as
9 !! published by the Free Software Foundation, either version 3 of
10 !! the License, or (at your option) any later version.
11 !!
12 !! qr_mumps is distributed in the hope that it will be useful,
13 !! but WITHOUT ANY WARRANTY; without even the implied warranty of
14 !! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 !! GNU Lesser General Public License for more details.
16 !!
17 !! You can find a copy of the GNU Lesser General Public License
18 !! in the qr_mumps/doc directory.
19 !!
20 !! ##############################################################################################
21 
22 
23 !! ##############################################################################################
33 
34 
37 
38 
39  character(len=*), parameter :: lcase='abcdefghijklmnopqrstuvwxyz'
40  character(len=*), parameter :: ucase='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
41 
42  interface qrm_str_tolower
43  module procedure qrm_str_tolower
44  end interface
45 
46  interface qrm_str_toupper
47  module procedure qrm_str_toupper
48  end interface
49 
50 contains
51 
52  function qrm_str_tolower(string)
53  character(len=*), intent(in) :: string
54  character(len=len(string)) :: qrm_str_tolower
55  integer :: i,k
56 
57  do i=1,len(string)
58  k = index(ucase, string(i:i))
59  if (k /= 0) then
60  qrm_str_tolower(i:i) = lcase(k:k)
61  else
62  qrm_str_tolower(i:i) = string(i:i)
63  end if
64  enddo
65 
66  return
67 
68  end function qrm_str_tolower
69 
70  function qrm_str_toupper(string)
71  character(len=*), intent(in) :: string
72  character(len=len(string)) :: qrm_str_toupper
73  integer :: i,k
74 
75  do i=1,len(string)
76  k = index(lcase, string(i:i))
77  if (k /= 0) then
78  qrm_str_toupper(i:i) = ucase(k:k)
79  else
80  qrm_str_toupper(i:i) = string(i:i)
81  end if
82  enddo
83 
84  return
85 
86  end function qrm_str_toupper
87 
88 end module qrm_string_mod
character(len=*), parameter lcase
character(len=*), parameter ucase
This module contains various string handling routines.