Breyta

Deila með


Len function

Applies to: Canvas apps Dataverse formula columns Desktop flows Model-driven apps Power Pages Power Platform CLI

Returns the length of a string of text.

Description

If you specify a single string as the argument, the return value is the length as a number. If you specify a single-column table that contains strings, the return value is a single-column table with a Value column that contains the length of each string. If you have a multi-column table, you can shape it into a single-column table, as working with tables describes.

If you specify a blank string, Len returns 0.

Syntax

Len( String )

  • String - Required. The string to measure.

Len( SingleColumnTable )

  • SingleColumnTable - Required. A single-column table of strings to measure.

Examples

Single string

For the examples in this section, the data source is a text-input control that's named Author and that contains the string "E. E. Cummings".

Formula Description Result
Len( Author.Text ) Measures the length of the string in the Author control. 14
Len( "" ) Measures the length of an empty string. 0

Single-column table

For the first example in this section, the data source is named People and contains this data:

Name Address
"Jean" "123 Main St NE"
"Fred" "789 SW 39th #3B"
Formula Description Result
Len( ShowColumns( People, "Address" ) ) In the Address column of the People table:
  • Measures the length of each string.
  • Returns a single-column table that contains the length of each string.
A single-column table with a Value column containing the following values: 14, 15
Len( [ "Hello", "to the", "World", "" ] ) In the Value column of the inline table:
  • Measures the length of each string.
  • Returns a single-column table that contains the length of each string.
A single-column table with a Value column containing the following values: 5, 6, 5, 0