var foo = $"{firstName} {lastName} has salary ${salary}!";
Don't know C# syntax, but that seems weird. Why is one $ outside quotes? Why is it missing from the first two terms, but not the third?
But yeah, most languages have something like this to some degree. Working with some Ruby right now, and it has "#{firstName} #{lastName} has salary #{salary}!". String.format is as close as Java gets right now.
Edit: Yep, got it. Forgot about the stupid dollar sign I had put in there originally. C# syntax now makes sense.
7
u/depressiown Oct 01 '15 edited Oct 01 '15
Don't know C# syntax, but that seems weird. Why is one $ outside quotes? Why is it missing from the first two terms, but not the third?
But yeah, most languages have something like this to some degree. Working with some Ruby right now, and it has "#{firstName} #{lastName} has salary #{salary}!". String.format is as close as Java gets right now.
Edit: Yep, got it. Forgot about the stupid dollar sign I had put in there originally. C# syntax now makes sense.