String
The two classes, String and Symbol, provide the ability to represent text and work with text. The two classes are very different.
String representation
A string is generally wrapped in a set of quotation marks:
"That's a string."Single
Type of a value
(1) Integral typeThe integer type is divided into two, if within 31 digits (four bytes), that is the Fixnum instance. If more than, that is the Bignum instance.
Copy Code code as follows:
#整型 integer below are some
Achieve 1
Copy Code code as follows:
String.prototype.trim = function () {
return this. Replace (/^\s\s*/, '). Replace (/\s\s*$/, ');
}
It does not look very good, using two of regular replacements, the actual speed is
Original article in this: https://www.cnblogs.com/cnkai/p/7642787.htmlThere is a personal modification and correctionConnecting to a databaseStrictredisFrom Redis import Strictredis#!/usr/bin/env python#Coding:utf-8 fromRedisImportStrictredis
A set of methods for removing spaces in JavaScript. The script home has previously released a lot of code for removing spaces, which is more comprehensive. Implementation 1
The Code is as follows:
String. prototype. trim = function (){Return this.
Achieve 1
Copy Code code as follows:
String.prototype.trim = function () {
Return This.replace (/^\s\s*/, '). Replace (/\s\s*$/, ");
}
It does not look very good, using two of regular replacements, the actual speed is
Copy codeThe Code is as follows:// Static method of String objectObject. extend (String ,{Interpret: function (value ){Return value = null? '': String (value );},SpecialChar :{'\ B': '\ B ','\ T':' \ t ','\ N':' \ n ','\ F':' \ F ','\ R':' \ R ','\\'
First, start the Python journey interactive mode1.Ctrl + D Enter an EOF character to exit the interpreter, or you can type exit () to exit2. #!/usr/bin/env python3 in #! called Shebang, the purpose is to tell the shell to use the Python interpreter
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.