Quantcast
Channel: What I learned today ? » Ruby
Viewing all articles
Browse latest Browse all 5

Building Strings in Ruby

$
0
0
If efficiency is important to you, don’t build a new string when you can append items onto an existing string. Constructs like str << ‘a’ + ‘b’ or  str << “#{var1} #{var2}” create new strings that are immediately subsumed into the larger string. This is exactly the thing to avoid. Use str << var1 << […]

Viewing all articles
Browse latest Browse all 5

Latest Images

Trending Articles



Latest Images