public static string VulgarFraction(int numerator, int denominator)
{
if(denominator == 0)
return "\u221E";
if(denominator < 0)
return VulgarFraction(-numerator, -denominator);
return numerator.ToString() + '\u2044' + denominator.ToString();
}
The precomposed vulgar fractions are included for compatibility, and not encouraged. Use U+2044 FRACTION SLASH to indicate a fraction. This indicates the desire to render as a fraction to a layout system, and is also widely supported by less sophisticated rendering methods.
If you really do need to use the precomposed characters, then a look-up table is the only reasonable way (you could build a big set of branching ifs and elses, but it's more work for less performance).