Main Content

本页采用了机器翻译。点击此处可查看英文原文。

strlength

确定 Requirements Table模块中字符串的长度

自 R2022b 起

描述

示例

l = strlength(str) 返回字符串 str 中的字符数。在 Requirements Table模块中使用此运算符。

示例

全部展开

Requirements Table模块中,创建一个需求,输出字符串 "Hello, world!" 中的字符数。

y = strlength("Hello, world!")

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

输入参数

全部展开

输入字符串,指定为字符串标量。将文字字符串用双引号引起来。

示例: "Hello"

数据类型: string

输出参量

全部展开

str 中的字符数,以双精度标量返回。

版本历史记录

在 R2022b 中推出

另请参阅

| | (Stateflow)