Rexx - pos() 方法

此方法返回一个字符串在另一个字符串中的位置。

语法

pos(substr,string1)

参数

  • string1 − 源字符串。

  • substr − 要在主字符串中搜索的子字符串。

返回值

此方法返回一个字符串在另一个字符串中的位置。

示例

/* 主程序 */
a = "Hello World" 
say pos("Hello",a)  

当我们运行上面的程序时,我们将得到以下结果。

输出

1 

❮ rexx_numbers.html