In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains the "ES6 string example analysis", the article explains the content is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "ES6 string example analysis" bar!
1. Two new methods have been added
(1) startWith: determine whether a string begins with a field
Let str='asdfgh';console.log (str.startsWith ('a')); / / true
Application:
Let str=' http://it.kaikeba.com'; If (str.startsWith ('http://')){ console.log)} else if (str.startsWith (' https://')){ console.log)} else if (str.startsWith ('git://')) {console.log ("git URL")} else if (str.startsWith (' svn://')) {console.log ("svn URL")} else { Console.log ("other URLs")}
(2) endsWith: determine whether a string ends with a field
By the same token:
Let str='asdfg.txt';if (str.endsWith ('.txt')) {console.log ("text file")} else if (str.endsWith ('.png')) {console.log ("png picture")} else if (str.endsWith ('.jpg')) {console.log ("jpg picture")} else {console.log ("other files")}
2. String template, string concatenation
(1) stuff something directly into the string
Let str1='asdfgh';// the first string method let str2='asdfgh';// the second string mode let str3= `asdfgh`; / / the third way: anti-single quotation marks / application: let axiom 12 let str4= `a ${a} bc`; console.log (str4); / / a12bc
(2) can be folded
Let title=' title'; let content=' content'; let str1='\'+ title+'\
'+ content+'
\'; let str2= `$ {title}
${content}
Thank you for your reading. the above is the content of "ES6 string instance Analysis". After the study of this article, I believe you have a deeper understanding of the problem of ES6 string instance analysis, and the specific usage needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
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.