In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly shows you how to use search() in javascript, the content is simple and easy to understand, clear organization, I hope to help you solve doubts, let Xiaobian lead you to study and learn "how to use search() in javascript" this article bar.
In javascript, the search() method is used to retrieve a specified substring in a string, or to retrieve a substring that matches a regular expression, returning the location of the first occurrence of the substring, syntax "string.search (searchvalue)"; if no matching substring is found, it returns "-1".
Operating environment of this tutorial: Windows 7 system, Javascript version 1.8.5, Dell G3 computer.
javascript search() method--search string
The search() method is used to retrieve a specified substring in a string or to retrieve a substring that matches a regular expression.
Grammar:
string.search(searchvalue)
Parameter Description:
SearchValue is required. A string or regular expression that looks up.
Return value:
Returns the starting position of a String object that matches the specified lookup string or regular expression.
Returns-1 if no matching substring is found.
Examples:
Perform a case-sensitive lookup
Click to show where to find
function myFunction(){ var str="Mr. Blue has a blue house" var n=str.search(/blue/i); document.getElementById("demo")[xss_clean]=n;}
The above is "how to use search() in javascript" all the content of this article, thank you for reading! I believe that everyone has a certain understanding, hope to share the content to help everyone, if you still want to learn more knowledge, welcome to pay attention to 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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.