大脑52分区功能及位置
The Pos function in Delphi returns an integer specifying the position of the first occurrence of one string within another.
Delphi中的Pos函数返回一个整数,该整数指定一个字符串在另一个字符串中首次出现的位置。
It's instantiated like this:
实例化如下:
Pos(String,Source);
它能做什么 ( What It Does )
Pos looks for the first complete occurrence of the specified String — generally offered literally, in single quotes — in Source. The Source is usually some variable. If Pos finds the string, it returns the character position in Source of the first character in Str as an integer value, otherwise it returns 0.
Pos在Source中寻找指定String的首次完整出现-通常按字面意义提供(单引号)。 Source通常是一些变量。 如果Pos找到了字符串,它将以整数值返回Str中第一个字符在Source中的字符位置,否则返回0。
The String and the Source must both be strings.
字符串和源都必须都是字符串。
例 ( Example )
var s : string;
i : integer;
s:='DELPHI PROGRAMMING';
i:=Pos('HI PR',s);
In this example, the variable i will return the integer 5, because the specified string begins with the letter H, which is in the fifth position in Source.
在此示例中,变量i将返回整数5 ,因为指定的字符串以字母H开头,该字母在Source中的第五个位置。
大脑52分区功能及位置