Ordinal suffixes in English for the nth degree
What aboutpublic static string NUMthOF(UInt32 v){ return v.ToString() + // Append the ordinal suffix for the unit digit // unless the ten digit is a one (force 'th') "thstndrdthththththth".Substring(2 * (int)(v / 10 % 10 != 1 ? v % 10 : 0), 2);}?Now all...
What about
public static string NUMthOF(UInt32 v)
{
return v.ToString() +
// Append the ordinal suffix for the unit digit
// unless the ten digit is a one (force 'th')
"thstndrdthththththth".Substring(2 * (int)(v / 10 % 10 != 1 ? v % 10 : 0), 2);
}
?
Now all the crypticism is concentrated in a single expression :)