Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
ensembl-gh-mirror
ensembl
Commits
db881e98
Commit
db881e98
authored
May 10, 2006
by
Patrick Meidl
Browse files
added commify()
parent
77022644
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
0 deletions
+23
-0
modules/Bio/EnsEMBL/Utils/ConversionSupport.pm
modules/Bio/EnsEMBL/Utils/ConversionSupport.pm
+23
-0
No files found.
modules/Bio/EnsEMBL/Utils/ConversionSupport.pm
View file @
db881e98
...
...
@@ -1410,4 +1410,27 @@ sub mem {
return
$mem
;
}
=head2 commify
Arg[1] : Int $num - a number to commify
Example : print "An easy to read number: ".$self->commify(100000000);
# will print 100,000,000
Description : put commas into a number to make it easier to read
Return type : a string representing the commified number
Exceptions : none
Caller : general
Status : stable
=cut
sub
commify
{
my
$self
=
shift
;
my
$num
=
shift
;
$num
=
reverse
(
$num
);
$num
=~
s/(\d\d\d)(?=\d)(?!\d*\.)/$1,/g
;
return
scalar
reverse
$num
;
}
1
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment