ByteToCharIndex
简述
字节索引到字符索引的转换。
ByteToCharIndex(const S: string; Index: Integer): Integer;
名称 | 类型 | 说明 |
---|
S | string | 字符串,源串 |
Index | Integer | 整数,字节位置 |
返回 | Integer |
整数,指定字节位置的字符位置。 |
//返回第30字节位置时,是第几个字符位置
//其中‘天软’占有4个字节,其余每个字符占1个字节
S:= "天软Tinysoft Statistical analysis Language";
return ByteToCharIndex(s,30);
//返回:28