libsim  Versione6.3.0

◆ 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 942 del file char_utilities.F90.

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_unlessxlf 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))
988  end do
989 
990  nchar=0
991  do i=1,len(in)
992  ia = ichar(in(i:i))
993  if (any(ia == igoodchar))then
994  nchar=nchar+1
995  charrr(nchar:nchar)=achar(ia)
996  end if
997  end do
998 
999 deallocate(igoodchar)
1000 
1001 else
1002 
Index method.

Generated with Doxygen.