OffsetToLineNumber
由 InsertIntoFunction 调用以将函数体中的索引转换为行号。
function OffsetToLineNumber(
strString,
nPos
);
参数
strString
包含函数体的字符串。函数体是多行字符串,其中的行由 cr-lf 字符对分隔。nPos
在字符串中的位置。
返回值
函数体中 nPos 所在的行。函数中的第一行被认为是行 1(不是 0)。
备注
查找函数体中给定位置的行号。
该函数由 InsertIntoFunction 调用以将函数体中位于 nPos 处的索引转换为行号。
示例
strString = "function DelFile(fso,
strWizTempFile)\r\n{\r\n\ttry\r\n\t{\r\nif
(fso.FileExists(strWizTempFile))\r\nreturn true;\r\n";
nLine = OffsetToLineNumber(strString, 60);
// The return value for the above is 5, because character 60 in the string
// occurs in the 5th line within the string.