|
◆ 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_string | string to be scanned |
| word_start | indices of first character of each word in input_string, allocated here, must be deallocated by the user |
| word_end | indices of last character of each word in input_string, allocated here, must be deallocated by the user |
| sep | optional word separator character, if not provided, a blank space is assumed |
Definizione alla linea 927 del file char_utilities.F90.
929 INTEGER, PARAMETER :: defaultcols = 80 930 INTEGER, PARAMETER :: maxcols = 256 931 CHARACTER(len=10) :: ccols 934 CALL getenv( 'COLUMNS', ccols) 935 IF (ccols == '') RETURN 937 READ(ccols, '(I10)', err=100) cols 938 cols = min(cols, maxcols) 939 IF (cols <= 0) cols = defaultcols 942 100 cols = defaultcols 944 END FUNCTION default_columns 948 FUNCTION suffixname ( Input_String ) RESULT ( Output_String ) 950 CHARACTER( * ), INTENT( IN ) :: Input_String 951 CHARACTER( LEN( Input_String ) ) :: Output_String 956 i = index(input_string, ".",back=.true.) 957 if (i > 0 .and. i < len(input_string)) output_string= input_string(i+1:) 959 END FUNCTION suffixname 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(:) 975 CHARACTER(len=len(in)) :: char,charr,charrr 976 INTEGER :: i,ia,nchar 982 if ( present(goodchar)) then 984 allocate(igoodchar(len(goodchar))) 986 do i =1, len(goodchar) 987 igoodchar=ichar(goodchar(i:i))
|