Len_trim

Function Type:

Len_trim is an elemental function that operates on CHARACTER variables.

Function Purpose:

The function will return the length of the character string stored in a character variable without counting any trailing blanks (but including leading blanks in the count).

Required Arguments:

len_trim(string)

String must be a character variable.

Note: The function must output to an INTEGER variable.

Optional Arguments:

There are no optional arguments.

Results:

Let us say the character variables word and word2 are declared and initialized as follows:
		character*10 word, word2
		word = 'trees     '
		word2 = 'big one   '
Then if you used them as arguments to the len_trim function like so:
		i = len_trim(word)
		j = len_trim(word2)
Then the variables i and j would contain the values of 5 and 7 respectively. The value of j is 7 because the len_trim function returns the length of the character variable minus the number of trailing blanks. The len_trim function does not subtract out any blanks that are between any character strings.

For More Information and Examples See:

lecture twenty five

example charvr90.f

Up one level / Home


Written by Jason Wehr : jcw142@psu.edu and Maintained by John Mahaffy : jhm@cac.psu.edu