如果找到搜索字符串,则所得结果是一个从1到输入字符串实际长度之间的一个数字,使用显式指定的代码单元来表示。
If string to be searched is found, the result is a number from 1 to the actual length of input string, expressed in the code units that are explicitly specified.
为了避免这一点,您必须显式地向代码添加字符串长度检查。
To avoid this, you must explicitly add string length checks to the code.
通常,一种有用的方法是,向“计数字符串”函数传递比缓冲区大小小一的长度,然后将零显式赋给缓冲区中的最后一个字符。
In general, one useful approach is to pass a length to the 'counted string' function one smaller than the size of the buffer and then explicitly assign zero to the last character in the buffer.
应用推荐