Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Euro -> formaating

Status
Not open for further replies.

Bramvg

IS-IT--Management
Jan 16, 2001
135
BE
Hi,

When some enters a number into a text field I would like to format (check) the entered number.

Because the format of the euro MUST be: xxxxx,xx
the first string (before the ',') can be as long as the user wants it, but before the last two numbers their must be a ','.

Example:

17897 = 178,97

Does anyone know how to do this?

With kind regards
bram
 
For something like this, you may want to look into the use of regular expressions. Regular expressions are used to check for a distinct string patterns. I've used JavaScript to validate form entries like email addresses, phone numbers, etc. ColdFusion's regular expressions feature is a bit disappointing though.
 
Something like this

<cfset vNum = 17897>

<cfoutput>
#ReReplace(vNum, &quot;(
Code:
[
Code:
[
:digit:
Code:
]
Code:
]
+)(
Code:
[
Code:
[
:digit:
Code:
]
Code:
]
{2})&quot;
, &quot;\1,\2&quot;)#
</cfoutput> - tleish
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top