Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Currency Symbol

Currency Symbol

Scheduled Pinned Locked Moved C#
question
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Dominic Farr
    wrote on last edited by
    #1

    How can I get the currency symbol from just the ISO 4217 standard 3-letter code. CAD = $ USD = $ GBP = £ YEN = ¥ I tried creating a RegionInfo by stripping out the first two characters of the 3-letter code but is doesn't work for all cases. Any ideas?

    E 1 Reply Last reply
    0
    • D Dominic Farr

      How can I get the currency symbol from just the ISO 4217 standard 3-letter code. CAD = $ USD = $ GBP = £ YEN = ¥ I tried creating a RegionInfo by stripping out the first two characters of the 3-letter code but is doesn't work for all cases. Any ideas?

      E Offline
      E Offline
      ediazc
      wrote on last edited by
      #2

      Stripping the first two chars of the code doesn't work because YEN => YE, but the country is JAPAN, code JP, BTW the ISO 4217 code for YEN is JPY, no YEN. You can use a HashTable, and fill it at start of your application, this way: HashTable ht = new HashTable(); foreach (CultureInfo ci in CultureInfo.GetCultures( CultureTypes.AllCultures ) ) { RegionInfo ri = new RegionInfo(ci.LCID); ht[ri.ISOCurrencySymbol] = ri.CurrencySymbol; } Later you access the symbol this way: string sym = (string) ht[isocode]; Eduardo Diaz site | english blog | spanish blog

      D 1 Reply Last reply
      0
      • E ediazc

        Stripping the first two chars of the code doesn't work because YEN => YE, but the country is JAPAN, code JP, BTW the ISO 4217 code for YEN is JPY, no YEN. You can use a HashTable, and fill it at start of your application, this way: HashTable ht = new HashTable(); foreach (CultureInfo ci in CultureInfo.GetCultures( CultureTypes.AllCultures ) ) { RegionInfo ri = new RegionInfo(ci.LCID); ht[ri.ISOCurrencySymbol] = ri.CurrencySymbol; } Later you access the symbol this way: string sym = (string) ht[isocode]; Eduardo Diaz site | english blog | spanish blog

        D Offline
        D Offline
        Dominic Farr
        wrote on last edited by
        #3

        thank you

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups