博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
字符串indexof方法_字符串indexOf()方法
阅读量:2504 次
发布时间:2019-05-11

本文共 569 字,大约阅读时间需要 1 分钟。

字符串indexof方法

Gives the position of the first occurrence of the string passed as parameter in the current string. Returns -1 if the string is not found.

给出作为参数传递的当前字符串中字符串首次出现的位置。 如果找不到该字符串,则返回-1。

'JavaScript'.indexOf('Script') //4'JavaScript'.indexOf('JavaScript') //0'JavaScript'.indexOf('aSc') //3'JavaScript'.indexOf('C++') //-1

You can pass a second parameters to set the starting point:

您可以传递第二个参数来设置起点:

'a nice string'.indexOf('nice') !== -1 //true'a nice string'.indexOf('nice', 3) !== -1 //false'a nice string'.indexOf('nice', 2) !== -1 //true

翻译自:

字符串indexof方法

转载地址:http://vaqgb.baihongyu.com/

你可能感兴趣的文章
Git(四) - 分支管理
查看>>
PHP Curl发送数据
查看>>
HTTP协议
查看>>
HTTPS
查看>>
git add . git add -u git add -A区别
查看>>
apache下虚拟域名配置
查看>>
session和cookie区别与联系
查看>>
PHP 实现笛卡尔积
查看>>
Laravel中的$loop
查看>>
CentOS7 重置root密码
查看>>
Centos安装Python3
查看>>
PHP批量插入
查看>>
laravel连接sql server 2008
查看>>
Laravel框架学习笔记之任务调度(定时任务)
查看>>
laravel 定时任务秒级执行
查看>>
浅析 Laravel 官方文档推荐的 Nginx 配置
查看>>
Swagger在Laravel项目中的使用
查看>>
Laravel 的生命周期
查看>>
CentOS Docker 安装
查看>>
Nginx
查看>>