libsim  Versione7.2.6

◆ word_split()

integer function, public char_utilities::word_split ( character(len=*), intent(in)  input_string,
integer, dimension(:), optional, pointer  word_start,
integer, dimension(:), optional, pointer  word_end,
character(len=1), optional  sep 
)

Split a line into words at a predefined character (default blank).

Returns the number of words in input_string. If pointers word_start and word_end are provided, they are allocated with nword elements and set to the indices of initial and final character of every word in input_string. Groups of contiguous separation characters are treated as a single separator character.

Parametri
[in]input_stringstring to be scanned
word_startindices of first character of each word in input_string, allocated here, must be deallocated by the user
word_endindices of last character of each word in input_string, allocated here, must be deallocated by the user
sepoptional word separator character, if not provided, a blank space is assumed

Definizione alla linea 927 del file char_utilities.F90.

927 INTEGER :: cols
928 
929 INTEGER, PARAMETER :: defaultcols = 80 ! default of the defaults
930 INTEGER, PARAMETER :: maxcols = 256 ! maximum value
931 CHARACTER(len=10) :: ccols
932 
933 cols = defaultcols
934 CALL getenv('COLUMNS', ccols)
935 IF (ccols == '') RETURN
936 
937 READ(ccols, '(I10)', err=100) cols
938 cols = min(cols, maxcols)
939 IF (cols <= 0) cols = defaultcols
940 RETURN
941 
942 100 cols = defaultcols ! error in reading the value
943 
944 END FUNCTION default_columns
945 
946 
948 FUNCTION suffixname ( Input_String ) RESULT ( Output_String )
949 ! -- Argument and result
950 CHARACTER( * ), INTENT( IN ) :: Input_String
951 CHARACTER( LEN( Input_String ) ) :: Output_String
952 ! -- Local variables
953 INTEGER :: i
954 
955 output_string=""
956 i = index(input_string,".",back=.true.)
957 if (i > 0 .and. i < len(input_string)) output_string= input_string(i+1:)
958 
959 END FUNCTION suffixname
960 
961 
968 ELEMENTAL FUNCTION wash_char(in, goodchar, badchar) RESULT(char)
969 CHARACTER(len=*),INTENT(in) :: in
970 CHARACTER(len=*),INTENT(in),OPTIONAL :: badchar
971 CHARACTER(len=*),INTENT(in),OPTIONAL :: goodchar
972 integer,allocatable :: igoodchar(:)
973 integer,allocatable :: ibadchar(:)
974 
975 CHARACTER(len=len(in)) :: char,charr,charrr
976 INTEGER :: i,ia,nchar
977 
978 char=""
979 charr=""
980 charrr=""
981 
982 if (present(goodchar)) then
983 
984 allocate(igoodchar(len(goodchar)))
985 
986  do i =1, len(goodchar)
987  igoodchar=ichar(goodchar(i:i))
Index method.

Generated with Doxygen.