BlitzCoder Essentials
•
Home Page
•
About BlitzCoder
•
Contributors
•
Terms of Use
•
Email Us
Main Areas
•
BlitzCoder Chat
•
Discussions
•
Articles/Tutorials
•
Code Database
•
Link Database
•
Showcase Area
•
Worklogs
•
Competitions
Special Areas
•
Undocumented
Other Blitz Sites
•
Blitz Basic Home
•
Blitz Showcase
•
BlitzPlay Library
Forum Login
Username:
Password:
•
Register Now!
BlitzCoder Code Archives Page
Main Codes Page
"Comma separated value"
, by thechange
Add a comma every 3 characters to increase readability: 123,456,789.
Code
Function WithCommas$ ( Value$ ) Local Counter% Local Count% For Counter = Len ( Value ) To 1 Step -1 If Count = 3 Then Value = Left ( Value , Counter ) + "," + Right ( Value , Len ( Value ) - Counter ) Count = 0 End If Count = Count + 1 Next Return Value End Function ; Testing the function Print WithCommas(-1) Print WithCommas(0) Print WithCommas(1) Print WithCommas(10) Print WithCommas(100) Print WithCommas(123) Print WithCommas(1234) Print WithCommas(10000) Print WithCommas(123456) Print WithCommas(1000000) Print WithCommas(10100100) Print WithCommas(100100100) Print WithCommas(3123123123) Print WithCommas(2000000000) Print WithCommas(-2147483648)
Copyright(c) 2000-2004, BlitzCoder. All Rights Reserved.
Code software created by Krylar's Kreations