Reference Guide > S Routines > STRLEN Function
  

STRLEN Function
Returns the length of the input parameter.
Usage
result = STRLEN(expr)
Input Parameters
expr—The expression for which the string length is desired.
If not of type string, expr is converted to string using the default formatting rules of PV‑WAVE. (These rules are described in the section Free Format Output in Chapter 8 of the PV-WAVE Programmer’s Guide.)
Returned Value
result—A long integer containing the string length of expr. If expr is an array, the result is an array with the same structure, with each element containing the length of the corresponding expr element.
Keywords
None.
Example
This example uses STRLEN to determine the length of several different strings.
; Create a scalar string.
a = 'a b c'
; Display the length of a.
PRINT, STRLEN(a)
; PV-WAVE prints: 5
 
; Create an integer scalar variable.
b = 45
; Display the length of b converted to string type.
PRINT, STRLEN(b)
; PV-WAVE prints: 8
; Display the result of b converted to a string.
INFO, STRING(b)
 
; Create a four-element vector of strings.
c = STRING(FINDGEN(4), Format = '(f3.1)')
; Display the contents of c as a column vector.
PM, c
; Display vector of lengths of elements of c as a column vector.
; This vector is returned by STRLEN.
PM, STRLEN(c)
See Also
STRMID, STRPOS, STRPUT, STRTRIM

Version 2017.0
Copyright © 2017, Rogue Wave Software, Inc. All Rights Reserved.