Main Content

strlength

Determine length of string in Requirements Table block

Since R2022b

Description

l = strlength(str) returns the number of characters in the string str. Use this operator in the Requirements Table block.

example

Examples

expand all

In a Requirements Table block, create a requirement that outputs the number of characters in the string "Hello, world!".

y = strlength("Hello, world!")

This image shows a requirement that outputs the number of characters in the string "Hello, world".

Input Arguments

expand all

Input string, specified as a string scalar. Enclose literal strings with double quotes.

Example: "Hello"

Data Types: string

Output Arguments

expand all

Number of characters in str, returned as a double-precision scalar.

Version History

Introduced in R2022b

See Also

| | (Stateflow)