Jump to content

Substitute "." by "€" in prices


Olivier

Recommended Posts

Hi friends,

I have to setup a menu card with prices composed like this : 12€90

The user in MarcomCentral portal will type the price like this : 12.90 or 12,90 as we do in France.

What may be the rule to substitute the "." or "," to "€" ? :)

 

Many thanks,

Olivier

FusionPro 9.3.36 on MacOS 10.10.5 and Acrobat Pro 10.1.16

Link to comment
Share on other sites

I never understood the red part below and will need to read up on it some more...is it an array of characters "." ","?

 

return Field('Your Field').replace(/[\.,]/g,'€');

 

Sorry and thanks in advance for the explanation.

Link to comment
Share on other sites

I never understood the red part below and will need to read up on it some more...is it an array of characters "." ","?

 

return Field('Your Field').replace(/[\.,]/g,'€');

 

Sorry and thanks in advance for the explanation.

 

There's no need to apologize. No, it's not an array – it's a regular expression.

 

In regular expressions (or RegExps), the brackets denote a character set. In this case, the character set is a '.' and a ',' but since the '.' has a special meaning in regexps, it has to be escaped with a backslash. The 'g' at the end means to search for those characters globally – don't just find and replace the first instance.

Link to comment
Share on other sites

  • 2 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...