首页 > 编程知识 正文

字符串strip的作用,setdefault函数

时间:2023-05-04 14:33:48 阅读:11308 作者:2427

字符串indexof方法

givesthepositionofthefirstoccurrenceofthestringpassedasparameterinthecurrentstring.returns-1 ifthestringisnotfound。

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

' JavaScript '.index of ' script '/4 ' JavaScript '.index of ' JavaScript ' )//0' JavaScript '.index of ' avascript '

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

' a nice string'.indexOf('nice '!==-1//true ' anice string '.index of (' nice ',3 )!==-1//false ' anice string '.index of (' nice ',2 )!==-1 //true为:3359 flavio copes.com/JavaScript-string-index of /

字符串indexof方法

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。