In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
In this article Xiaobian for you to introduce in detail "how to use indexOf () method to judge a string contains a character in js", the content is detailed, the steps are clear, and the details are handled properly. I hope that this article "how to use the indexOf () method to determine that a string contains a character in js" can help you solve your doubts.
1. IndexOf () method
Returns the index number in a string where you want to search for the first occurrence of the string value
If the string value to be retrieved does not appear, the method returns-1.
2. Use grammar
StrObj.indexOf (subString [, startIndex])
3. Parameters
StrObj (required): String object or text.
SubString (required): the substring to find in the String object.
StarIndex (optional): this integer value indicates the index to start the lookup within the String object. If omitted, look at the beginning of the string.
4. Use the indexOf () method to judge that a string contains a character
The let str= "abc" console.log (str.indexOf ("b")! =-1) / / true//indexOf () method returns the position where a specified string value first appears in the string. If the string value to be retrieved does not exist, return-1. This is the end of the article "how to use the indexOf () method in js to determine that a string contains a character." If you want to master the knowledge of this article, you still need to practice and use it. If you want to know more about the articles, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.