长度(字符串)
长度 | |
---|---|
术语名称 | 长度 |
英语名称 | length |
长度(length)指把一个字符串中字符的数量。
定义
长度 | |
---|---|
运算名称 | 长度 |
运算符号 | [math]\displaystyle{ |\bullet| }[/math] |
Latex | \vert\vert
|
运算对象 | 字符串 |
运算元数 | 1 |
运算结果 | 自然数 |
定义域 | [math]\displaystyle{ \Sigma^* }[/math] |
陪域 | [math]\displaystyle{ \mathbb{N} }[/math] |
对字符串 [math]\displaystyle{ a = \mathtt{a}_1 \mathtt{a}_2 \cdots \mathtt{a}_n }[/math] ,称 [math]\displaystyle{ n }[/math] 为字符串的长度(length),记作 [math]\displaystyle{ |a| }[/math] 。