Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 28th, 2006, 01:41 AM
Authorized User
 
Join Date: Nov 2004
Posts: 21
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to tks_muthu
Default Indian Currency Format In ASP CurrencyINR( )

Function CurrencyINR(CurStr)
Dim StrCur
Dim Amount
Dim LenAmt
Dim DecPos

'Convert into Decimal
CurStr=FormatNumber(CurStr)

'Change as String
Amount =Cstr(CurStr)

'Replace the Commas
Amount =Replace(CurStr,",","")

'Seperate the Rupees and Paise
StrCur=Left(Amount,Len(Amount))

'Find the Decimal Position
DecPos=Instr(StrCur,".")

'Find the Decimal Values
DecVal= Mid(StrCur,DecPos+1,2)

'Seperate the Rupees
StrCur= Mid(StrCur,1,DecPos-1)

'Find the Length of Amount
LenAmt=Len(StrCur)

'If Decimal Value is Null
If DecVal="" Then
    DecVal="00"
End If

'Adding the Commas
If LenAmt=1 Then
    StrCur=StrCur &"."& DecVal
ElseIF LenAmt=2 Then
    StrCur=StrCur &"."& DecVal
ElseIF LenAmt=3 Then
    StrCur=StrCur &"."& DecVal
ElseIF LenAmt=4 Then
    StrCur=Left(StrCur,1)&","& Right(StrCur,3) &"."& DecVal
ElseIF LenAmt=5 Then
    StrCur=Left(StrCur,2)&","& Right(StrCur,3)&"."& DecVal
ElseIF LenAmt=6 Then
    StrCur=Left(StrCur,1) &","& Mid(StrCur,2,2) & "," & Right(StrCur,3)&"."& DecVal
ElseIF LenAmt=7 Thenn
    StrCur=Left(StrCur,2) &","& Mid(StrCur,3,2) & "," & Right(StrCur,3)&"."& DecVal
ElseIF LenAmt=8 Then
    StrCur=Left(StrCur,1) &","& Mid(StrCur,2,2) & "," & Mid(StrCur,4,2) & "," & Right(StrCur,3)&"."& DecVal
ElseIF LenAmt=9 Then
    StrCur=Left(StrCur,2) &","& Mid(StrCur,3,2) & "," & Mid(StrCur,5,2) & "," & Right(StrCur,3)&"."& DecVal
end If
CurrencyINR=StrCur
End Function

:)

Muthu
__________________
Muthu





Similar Threads
Thread Thread Starter Forum Replies Last Post
Indian Rs Format simple Function for vb.net s.karthik General .NET 0 March 24th, 2008 06:27 AM
Currency Format kdkcchoco ASP.NET 1.0 and 1.1 Professional 1 March 29th, 2007 08:13 AM
Currency Format heerajee Pro PHP 2 June 5th, 2006 02:24 AM
format currency civa Access 3 December 16th, 2005 03:50 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.