Created
December 4, 2012 11:24
-
-
Save xdegtyarev/4202839 to your computer and use it in GitHub Desktop.
Get Currency Code From Currency Symbol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public string GetCurrencyCodeFromSymbol(string symbol) | |
{ | |
Debug.Log("Retrieving symbol" + symbol); | |
RegionInfo regionalInfo; | |
foreach(CultureInfo o in CultureInfo.GetCultures(CultureTypes.SpecificCultures)) | |
{ | |
regionalInfo = new RegionInfo(o.LCID); | |
Debug.Log("Regional Symbol" + regionalInfo.CurrencySymbol); | |
if(regionalInfo.CurrencySymbol == symbol) | |
{ | |
Debug.Log("returning symbol" + regionalInfo.ISOCurrencySymbol); | |
return regionalInfo.ISOCurrencySymbol; | |
} | |
} | |
Debug.Log("returning symbol empty"); | |
return string.Empty; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment