Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
ensembl
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ensembl-gh-mirror
ensembl
Commits
db881e98
Commit
db881e98
authored
18 years ago
by
Patrick Meidl
Browse files
Options
Downloads
Patches
Plain Diff
added commify()
parent
77022644
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
modules/Bio/EnsEMBL/Utils/ConversionSupport.pm
+23
-0
23 additions, 0 deletions
modules/Bio/EnsEMBL/Utils/ConversionSupport.pm
with
23 additions
and
0 deletions
modules/Bio/EnsEMBL/Utils/ConversionSupport.pm
+
23
−
0
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
;
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment