perl字符串处理函数.docxVIP

  • 3
  • 0
  • 约2.45千字
  • 约 2页
  • 2021-11-08 发布于江苏
  • 举报
perl字符串处理函数 1,index position = index (string, substring, position) 返回子串substrin在g 字符串string中的位置,如果不存在则返回-1。参数 positio是n 可选项, 表示匹配之前跳过的字符数,或者说从该位置开始匹配。 例子如下: [root@localhost ~]# echo -n /var/fap/test/123 | perl -ne $rev=index($_, a); print $rev,\n 2 [root@localhost ~]# echo -n /var/fap/test/123 | perl -ne $rev=index($_, a, 1); print $rev, 2 [root@localhost ~]# echo -n /var/fap/test/123 | perl -ne $rev=index($_, a, 3); print $rev, 6 [root@localhost ~]# echo -n /var/fap/test/123 | perl -ne $rev=index($_, a, 7); print $rev, -1 2,rindex position = rindex (string, substring, position) 与 index类似,区别

文档评论(0)

1亿VIP精品文档

相关文档