K kent New member May 24, 2009 #1 what code is used to display a number in a specific format eg: i want to display 50000 as 50,000
J Jeff New member May 24, 2009 #2 One way is with a disgusting regex: s/(^[-+]?\d+?(?=(?>(?:\d{3})+)(?!\d))⎪\G\d{3}(?=\d))/$1,/g; A more elegant way is to use the Number::Format module. That will give you the format_number() function, which will, by default add commas every 3 digits
One way is with a disgusting regex: s/(^[-+]?\d+?(?=(?>(?:\d{3})+)(?!\d))⎪\G\d{3}(?=\d))/$1,/g; A more elegant way is to use the Number::Format module. That will give you the format_number() function, which will, by default add commas every 3 digits