fork(12) download
  1. using System;
  2. using System.Globalization;
  3. using System.Linq;
  4. using System.Collections.Generic;
  5.  
  6. public class Test
  7. {
  8. public static void Main()
  9. {
  10. var cultures = CultureInfo.GetCultures(CultureTypes.AllCultures)
  11. .Where(c => !c.IsNeutralCulture);
  12. foreach (var ci in cultures)
  13. {
  14. var currencyValue = 1.234.ToString("C", ci);
  15. if(ci.StartsWithCurrencySymbol())
  16. Console.WriteLine("Culture: {0} RTLF? {1} Format: {2}",
  17. ci, ci.TextInfo.IsRightToLeft, currencyValue);
  18. }
  19. }
  20. }
  21.  
  22. public static class CultureInfoExtensions
  23. {
  24. public static bool StartsWithCurrencySymbol(this CultureInfo culture)
  25. {
  26. bool startsWithCurrencySymbol = culture.NumberFormat.CurrencyPositivePattern == 0
  27. || culture.NumberFormat.CurrencyPositivePattern == 2;
  28. return culture.TextInfo.IsRightToLeft ? !startsWithCurrencySymbol : startsWithCurrencySymbol;
  29. }
  30. }
Success #stdin #stdout 0.04s 34184KB
stdin
Standard input is empty
stdout
Culture:  RTLF? False Format: ¤1.23
Culture: zh-TW RTLF? False Format: NT$1.23
Culture: da-DK RTLF? False Format: kr 1,23
Culture: en-US RTLF? False Format: $1.23
Culture: he-IL RTLF? True Format: 1.23 ₪
Culture: it-IT RTLF? False Format: € 1,23
Culture: ja-JP RTLF? False Format: \1
Culture: ko-KR RTLF? False Format: ₩1
Culture: nl-NL RTLF? False Format: € 1,23
Culture: pt-BR RTLF? False Format: R$ 1,23
Culture: hr-HR RTLF? False Format: Kn 1,23
Culture: sq-AL RTLF? False Format: Lek1,23
Culture: th-TH RTLF? False Format: ฿1.23
Culture: id-ID RTLF? False Format: Rp1
Culture: be-BY RTLF? False Format: 1
Culture: sl-SI RTLF? False Format: SIT 1,23
Culture: fa-IR RTLF? True Format: 1 ﷼
Culture: mk-MK RTLF? False Format: Den 1,23
Culture: af-ZA RTLF? False Format: R1.23
Culture: ka-GE RTLF? False Format: 1,23
Culture: fo-FO RTLF? False Format: kr1,23
Culture: hi-IN RTLF? False Format: रु 1.23
Culture: sw-KE RTLF? False Format: KSh1.23
Culture: gu-IN RTLF? False Format: રુ 1.23
Culture: ta-IN RTLF? False Format: ரூ 1.23
Culture: te-IN RTLF? False Format: రూ. 1.23
Culture: kn-IN RTLF? False Format: रु 1.23
Culture: mr-IN RTLF? False Format: रु 1.23
Culture: kok-IN RTLF? False Format: रु 1.23
Culture: zh-CN RTLF? False Format: ¥1.23
Culture: de-CH RTLF? False Format: SFr. 1.23
Culture: en-GB RTLF? False Format: £1.23
Culture: es-MX RTLF? False Format: $1.23
Culture: it-CH RTLF? False Format: SFr. 1.23
Culture: nl-BE RTLF? False Format: € 1,23
Culture: zh-HK RTLF? False Format: HK$1.23
Culture: de-AT RTLF? False Format: € 1,23
Culture: en-AU RTLF? False Format: $1.23
Culture: zh-SG RTLF? False Format: S$1.23
Culture: en-CA RTLF? False Format: $1.23
Culture: es-GT RTLF? False Format: Q1.23
Culture: fr-CH RTLF? False Format: sFr. 1.23
Culture: zh-MO RTLF? False Format: P1.23
Culture: en-NZ RTLF? False Format: $1.23
Culture: es-CR RTLF? False Format: CRC1,23
Culture: en-IE RTLF? False Format: €1.23
Culture: es-PA RTLF? False Format: B/1.23
Culture: en-ZA RTLF? False Format: R1.23
Culture: es-DO RTLF? False Format: RD$1.23
Culture: es-VE RTLF? False Format: Bs1,23
Culture: es-CO RTLF? False Format: $1,23
Culture: es-PE RTLF? False Format: S/1.23
Culture: en-TT RTLF? False Format: $1.23
Culture: es-AR RTLF? False Format: $1,23
Culture: en-ZW RTLF? False Format: Z$1.23
Culture: es-EC RTLF? False Format: S/.1,23
Culture: en-PH RTLF? False Format: PHP1.23
Culture: es-CL RTLF? False Format: $1,23
Culture: es-UY RTLF? False Format: NU$ 1,23
Culture: es-PY RTLF? False Format: Gs 1
Culture: es-BO RTLF? False Format: $b1,23
Culture: es-SV RTLF? False Format: SVC1.23
Culture: es-HN RTLF? False Format: L.1.23
Culture: es-NI RTLF? False Format: C$1.23
Culture: es-PR RTLF? False Format: $1.23