Main Content

字符串数据

基于文本的值

字符串是一段文本数据。使用 Stateflow® 图中的字符串来控制图行为或创建自然语言输出。将字符串数据纳入记录、消息和自定义代码工作流中。

Stateflow 语法

全部展开

创建、串联和转换

string将值转换为字符串
blanksCharacter array of spaces
plusConcatenate strings
str2double将字符串转换为双精度值

确定类型和属性

isletterDetermine which characters are letters
isspaceDetermine which characters are spaces
isstringDetermine if input is string
strlengthDetermine length of string

查找和替换

containsDetermine if string contains substring
startsWithDetermine if string starts with substring
endsWithDetermine if string ends with substring
strfindFind substring within a string
extractAfterExtract substring after position
extractBeforeExtract substring before position
replaceFind and replace substrings
replaceBetweenReplace substrings between start and end points
strrepFind and replace substrings
eraseDelete substrings within strings
eraseBetweenDelete substring between start and end points
insertAfterInsert string after substring
insertBeforeInsert string before substring

编辑

lowerConvert string to lowercase
upperConvert a string to uppercase
reverseReverse order of characters in strings
stripRemove leading and trailing characters from string
strtrimRemove leading and trailing white space from string

比较

matchesDetermine if two strings match
strcmpCompare strings (case sensitive)
strcmpiCompare strings (case insensitive)
strncmpCompare first N characters of strings (case sensitive)
strncmpiCompare first N characters of strings (case insensitive)
ascii2str将类型为 uint8 的数组转换为字符串
str2ascii将字符串转换为 uint8 类型的数组
str2double将字符串转换为双精度值
strcat串联字符串
strcmpCompare strings (case sensitive)
strcpy字符串赋值
strlen确定字符串的长度
substr从字符串中提取子字符串
tostring将值转换为字符串

主题