String concatenation vs. interpolation in Ruby

Whenever TIMTOWTDI (there is more than one way to do it), you should look for the pros and cons. Using “string interpolation” (the second) instead of “string concatenation” (the first): Pros: Is less typing Automatically calls to_s for you More idiomatic within the Ruby community Faster to accomplish during runtime Cons: Automatically calls to_s for … Read more

PowerShell string interpolation syntax

To complement marsze’s helpful answer: ${…} (enclosing the variable name in { and }) is indeed always necessary if a variable name contains special characters, such as spaces, ., or -. Not special are _ and – surprisingly and problematically – ?. Note: : is invariably interpreted as terminating a PowerShell drive reference, in the … Read more

Why does string interpolation work in Ruby when there are no curly braces?

According to The Ruby Programming Language by Flanagan and Matsumoto: When the expression to be interpolated into the string literal is simply a reference to a global, instance or class variable, then the curly braces may be omitted. So the following should all work: @var = “Hi” puts “#@var there!” #=> “Hi there!” @@var = … Read more

How to solve “String interpolation produces a debug description for an optional value; did you mean to make this explicit?” in Xcode 8.3 beta?

This is a change that was made in this pull request due to the fact that interpolating Optional(…) into the resultant string is often undesirable, and can be especially surprising in cases with implicitly unwrapped optionals. You can see the full discussion of this change on the mailing list here. As mentioned in the pull … Read more

How do I interpolate strings?

This has been added as of C# 6.0 (Visual Studio 2015+). Example: var planetName = “Bob”; var myName = “Ford”; var formattedStr = $”Hello planet {planetName}, my name is {myName}!”; // formattedStr should be “Hello planet Bob, my name is Ford!” This is syntactic sugar for: var formattedStr = String.Format(“Hello planet {0}, my name is … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)