long_string = <<EOS
It was the best of times,
It was the worst of times.
EOS
जो 53 देता है। क्यों? व्हाइटस्पेस गिना जाता है? यहां तक कि अभी भी। हम 53 कैसे प्राप्त करते हैं?मुझे समझ में नहीं आता क्यों स्ट्रिंग.size देता है
इस बारे में कैसे?
def test_flexible_quotes_can_handle_multiple_lines
long_string = %{
It was the best of times,
It was the worst of times.
}
assert_equal 54, long_string.size
end
def test_here_documents_can_also_handle_multiple_lines
long_string = <<EOS
It was the best of times,
It was the worst of times.
EOS
assert_equal 53, long_string.size
end
इस मामले क्योंकि% {मामले, 2 पंक्ति के अंत में प्रत्येक /n
एक के रूप में चरित्र और थेरेस पहली पंक्ति से पहले एक, अंत में से एक माना जाता मायने रखता है, और उसके बाद में जबकि है EOS
केस पहली पंक्ति से पहले एक और पहली पंक्ति के बाद एक है? दूसरे शब्दों में, पूर्व 54 और बाद वाले 53 क्यों हैं?
ओह कृपया नहीं चार्ल्स डिकेंस उद्धरण ... – alternative