libsim Versione 7.2.6
|
◆ word_split()
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.
Definizione alla linea 916 del file char_utilities.F90. 917
918END FUNCTION line_split_get_line
919
920
921!> Return the number of columns in the terminal, if available it is
922!! taken from the \a COLUMNS environment variable (it may be necessary
923!! to execute \c export \c COLUMNS before running the program, in
924!! order for this to work), otherwise it is set to 80. A positive
925!! value is returned in any case
926FUNCTION default_columns() RESULT(cols)
927INTEGER :: cols
928
929INTEGER, PARAMETER :: defaultcols = 80 ! default of the defaults
930INTEGER, PARAMETER :: maxcols = 256 ! maximum value
931CHARACTER(len=10) :: ccols
932
933cols = defaultcols
934CALL getenv('COLUMNS', ccols)
935IF (ccols == '') RETURN
936
937READ(ccols, '(I10)', err=100) cols
938cols = min(cols, maxcols)
939IF (cols <= 0) cols = defaultcols
940RETURN
941
942100 cols = defaultcols ! error in reading the value
943
944END FUNCTION default_columns
945
946
947!> Return the suffix of a filename.
948FUNCTION suffixname ( Input_String ) RESULT ( Output_String )
949! -- Argument and result
950CHARACTER( * ), INTENT( IN ) :: Input_String !< string to be interpreted as a filename
951CHARACTER( LEN( Input_String ) ) :: Output_String
952! -- Local variables
953INTEGER :: i
954
955output_string=""
957if (i > 0 .and. i < len(input_string)) output_string= input_string(i+1:)
958
959END FUNCTION suffixname
960
961
962!> Remove the requested characters from a string.
963!! This function returns a string cleaned from unwanted characters,
964!! either by removing "bad" characters (argument \a badchar) or by
965!! keeping only "good" characters (argument \a goodchar). If neither
966!! \a badchar nor \a goodchar are provided, it keeps only alphabetic
967!! ASCII characters.
968ELEMENTAL FUNCTION wash_char(in, goodchar, badchar) RESULT(char)
969CHARACTER(len=*),INTENT(in) :: in !< string to be cleaned
970CHARACTER(len=*),INTENT(in),OPTIONAL :: badchar !< optional set of "bad" characters
971CHARACTER(len=*),INTENT(in),OPTIONAL :: goodchar !< optional set of "good" characters
972integer,allocatable :: igoodchar(:)
973integer,allocatable :: ibadchar(:)
974
975CHARACTER(len=len(in)) :: char,charr,charrr
976INTEGER :: i,ia,nchar
977
|