The values in the original value vs object javascript can be divided into two categories: the original value (primitive) and the object (object ). Define the two types of javascript values: the following values are the original values. String number:
Regular expression for matching Chinese characters: [u4e00-u9fa5] matching double byte characters (including Chinese characters): [^ x00-xff] application: calculate the length of a string (a double byte character length meter 2, 1) String. prototype.
Code of the enhanced JavaScript trim function
The code is as follows:
String. prototype. trim = function (){Var _ argument = arguments [0] | "";Var _ re = new RegExp ("(^" + _ argument + "*) | (" + _ argument + "* $)", "g"); // case
Since the ORACLE database contains two Chinese characters and symbols, and one digit and one byte of English, it is incorrect to use the EXTJS text box MaxLenght to limit the input length, because EXTJS only limits the number of input words, not the
JQuery front-end data acquisition implementation code. For more information, see. JProviderData
The Code is as follows:
///
$ J = jQuery. noConflict ();(Function ($ j ){$ J. providerData = {DefaultSettings :{Select_Span_Items:
Removing spaces in js does not allow you to directly use trim to delete the space. It is not as easy as we thought in js, especially the trim function that is less reliable than the code that I want to delete spaces before and after.
The Code is
This article mainly introduces common JS verification scripts, and summarizes and analyzes the built-in and custom functions used by JavaScript for verification in the form of examples. It has some reference value, for more information about JS
Let's briefly introduce Functional. js.
Functional. js imitates the Haskell language standard library PreludeThe function programming library is mainly implemented as follows:
Extended Kerry Functions
Operator Function
Compact anonymous
/*** Word truncation plug-in * wordlimit (OBJ); automatically obtains the CSS width for processing. If no width is specified for the jquery object OBJ in CSS, * wordlimit (OBJ, 24). Number of truncated characters. The value must be an integer
I received a request today:
1. Extract the output text and retain 400 characters.
2. If the content to be intercepted is a url, the complete url address is retained.
3. Add a ellipsis ......
----
It is difficult to retain the url, especially when
Prototype is an API written in Javascript, including the expansion of Javascript classes such as String and Array. You can embed Javascript files and use them directly.Copy codeThe Code is as follows:String. prototype. strLen = function (){Var len =
Method 1:
// Remove the space on the left of the stringFunction ltrim (STR){If (Str. charat (0) = ""){// If the first character on the left of the string is a spaceSTR = Str. Slice (1); // remove spaces from the string// This sentence can also be
There are many methods, for example:
First: (use the charcodeat method of the string object)
CopyCode The Code is as follows: String. Prototype. getbyteslength = function (){
VaR length = 0;
For (I = 0; I Icode = This. charcodeat (I );
If (icode> =
CopyCodeThe Code is as follows: String. Prototype. Trim = function (){
VaR _ argument = arguments [0] | "";
VaR _ Re = new Regexp ("(^" + _ argument + "*) | (" + _ argument + "* $)", "G"); // case sensitive
Return this. Replace (_ re ,"");
}
The following are examples of creating Web files and settings that require a VBS file (with virtual directory settings but no permissions settings).
////////////////////////////////////////////////////////////////////////////////
//
IIIIIII
Type 1: String. prototype. replaceAllfunction (s1, s2) {returnthis. replace (newRegExp (s1, & quot; gm & quot;), s2); // The gm here is fixed, g may represent global, and m may represent multiple .} Type 2: varreg/\ s/g; // here... type 1:
String.
Let's take a look at a JavaScript question. It is said that it is a JavaScript question for a well-known Internet company in China. If you do not know about the global matching mode of regular expressions, you may be confused about the following
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.