LEN (The GNU Fortran Compiler)

### 8.175 `LEN` — Length of a character entity ¶

Synopsis:

  `L = LEN(STRING [, KIND])`

Description:

  Returns the length of a character string. If STRING is an array, the length of an element of STRING is returned. Note that STRING need not be defined when this intrinsic is invoked, since only the length, not the content, of STRING is needed.

Class:

  Inquiry function

Arguments:

  STRING | Shall be a scalar or array of type `CHARACTER`, with `INTENT(IN)`
  KIND | (Optional) A scalar `INTEGER` constant expression indicating the kind parameter of the result.

Return value:

  The return value is of type `INTEGER` and of kind KIND. If KIND is absent, the return value is of default integer kind.

Specific names:

  Name | Argument | Return type | Standard
  --- | --- | --- | ---
  `LEN(STRING)` | `CHARACTER` | `INTEGER` | Fortran 77 and later

Standard:

  Fortran 77 and later, with KIND argument Fortran 2003 and later

See also:

  `LEN_TRIM` — Length of a character entity without trailing blank characters,
  `ADJUSTL` — Left adjust a string,
  `ADJUSTR` — Right adjust a string