Hidden features of Scala

Okay, I had to add one more. Every Regex object in Scala has an extractor (see answer from oxbox_lakes above) that gives you access to the match groups. So you can do something like: // Regex to split a date in the format Y/M/D. val regex = “(\\d+)/(\\d+)/(\\d+)”.r val regex(year, month, day) = “2010/1/13” The … Read more

Hidden Features of C#? [closed]

This isn’t C# per se, but I haven’t seen anyone who really uses System.IO.Path.Combine() to the extent that they should. In fact, the whole Path class is really useful, but no one uses it! I’m willing to bet that every production app has the following code, even though it shouldn’t: string path = dir + … Read more