- Feature Articles
- Other Articles
Code Snippet Of the Day (CodeSOD) features interesting and usually incorrect code snippets taken from actual production code in a commercial and/or open source software projects.
“This is part of a home-grown transpiler…”, Adam wrote. I could stop there, but this particular transpiler has a… unique way of deciding if it should handle module imports.
Given a file, this Groovy code will check each line of the file to see if it includes an import line, and then return true or false, as appropriate.
C++ is a language with a… checkered past. It’s grown, matured and changed over the decades, and modern C++ looks very little like the C++ of yesteryear. Standard libraries have grown and improved- these days,
std feels nearly as big and complicated as parts of Java’s class library.
One useful function is
std::toupper. Given a
char, it will turn that
char into an upper-case version, in a locale-aware fashion. What if you want to turn an entire string to upper-case?