Problem is you cannot use NumberFormatInfo class to get proper culture object and at the same time trail zeros... So you have to do some manipulation on string if you want to achieve what I needed.
Output I wanted:
"$10.2"
"£50.465"
"23,54 €"
As per standards for writting currencies natively.
I resolved with complex string manipulation (aka some work on strings)...
public static string LocalizeJackpots(this HtmlHelper html, decimal amount, byte currencyType)
{
var httpContext = new HttpContextWrapper(HttpContext.Current);
string countryCulture = httpContext.Request.Cookies["countryCulture"].Value;
var culture = GetCultureByCurrencyType(currencyType, countryCulture);
return ManipulateCurrencyString(amount.ToString("c", culture));
}
And then:
/// <summary>
/// This is used to properly trail leading zeros with usage of NumberFormatInfo culture class later in string
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
private static string ManipulateCurrencyString(string input)
{
char lastCharacter = input.Substring(input.Length - 1, 1)[0];
if (Char.IsNumber(lastCharacter))
{
// for currencies with symbol in front
input = input.TrimEnd("0".ToCharArray()).TrimEnd(".".ToCharArray());
}
else
{
// for currencies with symbol in the end
string symbol = input.Substring(input.Length - 1, 1);
string number = input.Substring(0, input.Length - 2).TrimEnd("0".ToCharArray()).TrimEnd(".".ToCharArray()).TrimEnd(",".ToCharArray());
input = number + " " + symbol;
}
return input;
}