In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)05/31 Report--
This article introduces the relevant knowledge of "whether there is a trim method in javascript". In the operation of actual cases, many people will encounter such a dilemma. Next, let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
There is a trim method in javascript. Trim () is a string processing method built into javascript that removes the beginning and end of a string with the syntax "string.trim ()"; the spaces that can be deleted by the trim method include space characters, tabs, line feeds, carriage returns, and so on.
The operating environment of this tutorial: windows7 system, javascript1.8.5 version, Dell G3 computer.
There is a trim method in javascript.
The trim () method is used to remove the leading and trailing white space character of a string. The syntax is as follows:
String.trim ()
The trim () method removes the following white space characters:
"": normal space character
"\ t": tabs
"\ n": newline character
"\ r": carriage return
"\ 0": empty byte character
"\ x0B": vertical tab.
The trim () method does not change the original string.
The trim () method does not apply to null, undefined, Number types.
JavaScript version: ECMAScript 5
Return value: returns a string that removes leading and trailing spaces
Example:
Function f () {var str1 = `123`; console.log (str1); console.log (str1.trim ()); var str2 = `\ n23\ n4`; console.log (str2); console.log (str2.trim ());} f ()
This is the end of the content of "is there any trim method for javascript"? thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
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: 271
*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.