[cisco-voip] IPCC: remove $ and , from a string.

Patrick Mowry pmowry at getgds.com
Wed Jan 16 21:26:12 EST 2008


I found a solution.
  To sum things up I have a dollar amount stored in a database field as a string.  The string always begins with $ but does not always contain a , (both $1,700.00 and $1700.00 can be in the database).  So I used .substring(1) to get rid of the $, then .replaceAll(",","" ) to get rid of any , and finally Create Generated Prompt currency to play if back to the caller.

IF I made this more complicated than it has to be, please point out the better way to do it,

Thanks,

-Patrick


-----Original Message-----
From: Patrick Mowry
Sent: Wed 1/16/2008 3:10 PM
To: cisco-voip at puck.nether.net
Subject: IPCC: remove $ and , from a string.
 
Hello,
  I need to read out as currency a database entry that is like $1,700.00 in the database.  Getting rid of the $ is easy with the substring command, but how do I strip out the , since it may not always be the 3rd digit or even exist at all?

Thanks,

-Patrick




More information about the cisco-voip mailing list