dc_string::strinclude Interface Reference

Private Member Functions

logical function str_include_ac (carray, string, ignore_space, ignore_case)
 

Detailed Description

Definition at line 158 of file dc_string.f90.

Member Function/Subroutine Documentation

◆ str_include_ac()

logical function dc_string::strinclude::str_include_ac ( character(*), dimension(:), intent(in)  carray,
character(*), intent(in)  string,
logical, intent(in), optional  ignore_space,
logical, intent(in), optional  ignore_case 
)
private

Definition at line 446 of file dc_string.f90.

446  !
447  ! 文字型配列引数 *carray* が文字型引数 *string* と等しい要素を持つ場合に
448  ! .true. を返します.
449  !
450  ! 文字列の前後の空白は無視されます.
451  ! オプショナル引数 *ignore_space* に .false. を
452  ! 与えた場合には文字列先頭の空白を無視しません.
453  !
454  ! オプショナル引数 *ignore_case* に .true. を与えた場合には
455  ! 大文字, 小文字の違いを無視して比較します.
456  !
457  ! If an character array argument *carray* has the same
458  ! as character argument *string*, ".true." is returned.
459  !
460  ! And beginning and trailing spaces are ignored.
461  ! If ".false." is given to an optional argument *ignore_space*,
462  ! beginning spaces are not ignored.
463  !
464  ! If ".true." is given to an optional argument *ignore_case*,
465  ! this function ignores case.
466  !
467  character(*), intent(in):: carray(:)
468  character(*), intent(in):: string
469  logical, intent(in), optional:: ignore_space
470  logical, intent(in), optional:: ignore_case
471  integer:: array_size, i
472  logical:: ignore_space_work, ignore_case_work
473 
474  continue
475 
476  ignore_space_work = .true.
477  if ( present(ignore_space) ) then
478  if ( .not. ignore_space ) then
479  ignore_space_work = .false.
480  end if
481  end if
482 
483  ignore_case_work = .false.
484  if ( present(ignore_case) ) then
485  if ( ignore_case ) then
486  ignore_case_work = .true.
487  end if
488  end if
489 
490  array_size = size(carray)
491  do i = 1, array_size
492  if ( ignore_space_work ) then
493  if ( ignore_case_work ) then
494  result = &
495  & strieq_cc( trim( adjustl( carray(i) ) ), &
496  & trim( adjustl( string ) ) )
497  else
498  result = &
499  & ( trim( adjustl( carray(i) ) ) == trim( adjustl( string ) ) )
500  end if
501 
502  else
503  if ( ignore_case_work ) then
504  result = &
505  & strieq_cc( trim( carray(i) ), trim( string ) )
506  else
507  result = ( trim(carray(i)) == trim(string) )
508  end if
509  end if
510  if (result) return
511  end do
integer, parameter, public string
文字列を保持する 文字型変数の種別型パラメタ
Definition: dc_types.f90:118

The documentation for this interface was generated from the following file: