strmid
注意
这个$函数以小写字母开头。
描述
该函数用于从字符串中提取指定范围的字符。
参数 | 说明 |
---|---|
dest[] | 存储提取结果的目标字符串 |
const source[] | 源字符串 |
start | 起始位置(基于 0 的索引) |
end | 结束位置(基于 0 的索引) |
maxlength = sizeof (dest) | 目标字符串的最大容量(默认为 dest 数组长度) |
返回值
存入目标字符串的字符数量。
示例代码
new string[6];
// 从字符串提取'HELLO'并去除感叹号
strmid(string, "Extract 'HELLO' without the !!!!: HELLO!!!!", 34, 39);
// 字符串将包含"HELLO"