看板 Ruby 關於我們 聯絡資訊
http://ruby-doc.org/core-2.0.0/String.html 的count([other_str]+) → fixnum 這個章節 我看不太懂他\\的某些意思 1. "hello^world".count "\\^aeiou" #=>4 應該是指 e*1 ^*1 o*2吧? 但是我改成 "hello^world".count "^aeiou" # => 8 為什麼會變成8@@? 2. "hello world\\r\\n".count "X-\\w" #=> 3 這裡也看不太懂"X-\\w"是什麼意思 3. "hello world".count "lo", "o" #=> 2 是因為hello world 所以是二次嗎? 感覺後面變二個參數後 就由字元比對變成字串比對了 是嗎? 4. 另外再外插一件和count無關的問題 books["Gravity's Rainbow"] = :splendid 這個是什麼意思? 請版上的各位先進幫我解答QQ~謝謝.... -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 1.172.101.72 ※ 編輯: flyingIdea 來自: 1.172.101.72 (12/17 15:54)