Main Content

strlength

Determine length of string

Description

example

L = strlength(str) returns the number of characters in the string str.

Note

The operator strlength is not supported in Stateflow® charts that use C as the action language. For similar functionality, use strlen.

Examples

expand all

Return a value of 13, the number of characters in the string.

str = "Hello, world!";
L = strlength(str);

Stateflow chart that uses the string operator in a state.

Input Arguments

expand all

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

Example: "Hello"

Version History

Introduced in R2021b