How do I find the Excel column name that corresponds to a given integer? [duplicate]

I once wrote this function to perform that exact task: public static string Column(int column) { column–; if (column >= 0 && column < 26) return ((char)(‘A’ + column)).ToString(); else if (column > 25) return Column(column / 26) + Column(column % 26 + 1); else throw new Exception(“Invalid Column #” + (column + 1).ToString()); }

Algorithm for iterating over an outward spiral on a discrete 2D grid from the origin

There’s nothing wrong with direct, “ad-hoc” solution. It can be clean enough too. Just notice that spiral is built from segments. And you can get next segment from current one rotating it by 90 degrees. And each two rotations, length of segment grows by 1. edit Illustration, those segments numbered … 11 10 7 7 … Read more

Why would a language NOT use Short-circuit evaluation?

Reasons NOT to use short-circuit evaluation: Because it will behave differently and produce different results if your functions, property Gets or operator methods have side-effects. And this may conflict with: A) Language Standards, B) previous versions of your language, or C) the default assumptions of your languages typical users. These are the reasons that VB … Read more