Search code examples
asp-classiccurrencylcid

How to covert currency as per locale ID


I am using locale Id(LCID) in classic ASP. I have currency in 7177 locale Id(South Africa). I want to convert it to the currency with locale id 3081(Australia). For example, if input is 13,10 then output should be 13.10.

I try this :

function getNumberStr(number)
    response.write("session.lcid" & session.lcid &"number:" & number & "</br>") 
    currentLCID = session.lcid

    session.lcid = 3081
    number = formatcurrency(number)
    str = Cstr(number)
    response.write("session.lcid" & session.lcid &"number:" & number & "str:" & str & "</br>") 
    session.lcid = currentLCID
    getNumberStr = str
end function

My initial locale Id is 7177 and I am calling this function like:

x = "10,10"
getNumberStr(x)

but i am not getting expected output.


Solution

  • Pass the expression to be formatted as a number:

    x = CDbl("10,10")
    getNumberStr(x)