count_sep Function

private function count_sep(str_in, separator) result(n_sep)

Arguments

Type IntentOptional Attributes Name
character(len=*), intent(in) :: str_in
character(len=1), intent(in) :: separator

Return Value integer


Called by

proc~~count_sep~~CalledByGraph proc~count_sep count_sep proc~getintallocarray GETINTALLOCARRAY proc~getintallocarray->proc~count_sep proc~getintarray GETINTARRAY proc~getintarray->proc~count_sep proc~getrealallocarray GETREALALLOCARRAY proc~getrealallocarray->proc~count_sep proc~getrealarray GETREALARRAY proc~getrealarray->proc~count_sep proc~initanalyze InitAnalyze proc~initanalyze->proc~getrealallocarray proc~initmhd3d t_functional_mhd3d%InitMHD3D proc~initmhd3d->proc~getrealallocarray proc~initprofile InitProfile proc~initmhd3d->proc~initprofile proc~initprofile->proc~getrealallocarray

Source Code

FUNCTION count_sep(str_in,separator) RESULT(n_sep)
  IMPLICIT NONE
  !-------------------------------------------
  ! input
  CHARACTER(LEN=*),INTENT(IN) :: str_in
  CHARACTER(LEN=1),INTENT(IN) :: separator
  ! output
  INTEGER :: n_sep
  !-------------------------------------------
  ! LOCAL VARIABLES
  CHARACTER(LEN=LEN(str_in)) :: str_tmp
  INTEGER :: len_in,i
  !==============================================================================
  n_sep=0
  len_in=LEN_TRIM(str_in)
  str_tmp=TRIM(str_in)
  IF(str_tmp(1:1).EQ.separator) THEN
    CALL abort(__STAMP__,&
         "parameter readin, count separator:  first character should not be a separator!")
  END IF
  DO i=2,len_in-1
    IF (str_tmp(i:i).EQ.separator) THEN
      n_sep=n_sep+1
    END IF
  END DO
  IF(str_tmp(len_in:len_in).EQ.separator) THEN
    CALL abort(__STAMP__,&
         "parameter readin, count separator: last character should not be a separator!")
  END IF
END FUNCTION count_sep