This code:
url_for(url,mode)[0,2] == "!!"
Checks that the first (offset 0
) two characters (,2
) are equivalent to "!!"
. This is now something you can express as:
url_for(url,mode).start_with?("!!")
Which might make it easier to understand.
The String#[]
method has two forms relevant to understanding this:
"hello"[0] # Character index
# => "h"
"hello"[0,1] # Equivalent to above
# => "h"
"hello"[0,2] # Su
# => "he"
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…