String object learning notes in Ruby, rubystring
1. String object definition
You can use "" And ''to define String objects. For simple strings, you are advised to use'' to define them. The efficiency is higher than "". The difference between "" And '
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 ','\\'
View
View is divided into builder mode and rhtml mode.
The following is an example of the builder mode.
XML. Div (: class => "productlist") DoXML. timestamp (time. Now)@ Products. Each do | product |XML. Product doXML. productname (product.
First, let's create a simple string, and we will often operate on it for example:
VaR string = 'laziness always pays off now .';String. gsubThe gsub method is similar to the native replace method of JavaScript, but it is more powerful. It accepts
1. Extension and repair of stringsLanguage scripts are particularly concerned with strings, and there are three main types of methods:First Class: Tag-independent implementations :
Original Author: Scott Raymond
Translation notes: Rubyoo
Original: http://www.xml.com/pub/a/2007/01/24/whats-new-in-prototype-15.html
Source: http://www.rubyoo.com/
With the world's greatest web development Framework, the official release of Rails
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.