logo
g Text Version
Auto
Beauty & Self
Books & Music
Career
Computers
Education
Family
Food & Wine
Health & Fitness
Hobbies & Crafts
Home & Garden
Money
News & Politics
Relationships
Religion & Spirituality
Society & Culture
Sports
Travel & Leisure
TV & Movies

dailyclick
Bored? Games!
Postcards
Astrology
Take a Quiz
Rate My Photo

new
English Garden
Costuming
Charity
Women's Fashion
Pop Music


dailyclick
All times in EST

Full Schedule
g
g ASP Site
Editor Wanted
BellaOnline's ASP Editor

g

3-digits Formatting a String
Guest Author - Linawaty


Sometimes, you want to format a string into separated 3-digits to make it easier to read. This is the function to do it. You just need to paste it somewhere in your ASP code (or include it) and call it from anywhere in your code.

Scenario:
input = string eg. "1234567890"
output = string eg. "1,123,456,789"

Function:

function SenFormat(a)
    org=a
    if len(org)>3 then
        do while len(org)>3
            sema=left(org,len(org)-3)
            semb=right(org,3)
            semNew= "," & semb & semNew
            org=sema
        loop
        SenFormat=sema & semNew
    else
        SenFormat=org
    end if
    'this is where your customization goes
end function

Of course you can customize the script a bit.

Example1:
Scenario1: Change the separator
input = string eg. "1234567890"
output = string eg. "1.123.456.789"

Change to function:
Replace the "," with "."
    semNew= "." & semb & semNew

Example2:
Scenario2: Add the currency sign
input = string eg. "1234567890"
output = string eg. "Rp 1.123.456.789"

Change to function:
Add this code line below the "'this is where your customization goes":
    SenFormat = "Rp " & SenFormat
where "Rp" is a currency sign here, you can alter it to suit your currency, such as dollar($), pound(£), yen(¥).


This site needs an editor - click to learn more!

RSS | Related Articles | Previous Features | Site Map


Content copyright © 2008 by Linawaty. All rights reserved.
This content was written by Linawaty. If you wish to use this content in any manner, you need written permission. Contact BellaOnline Administration for details.

Digg! g delicious Save to Del.icio.us

g


For FREE email updates, subscribe to the ASP Newsletter


Past Issues


print
Printer Friendly
bookmark
Bookmark
tell friend
Tell a Friend
forum
Forum
email
Email Editor

g features
Best uses for RSS

RSS and its future.

Force Download Dialog box with ASP

Archives | Site Map

forum
Forum
email
Contact

Past Issues
memberscenter


vote
Driving Amount
Much more
Slightly more
Slightly less
Much less

g


| About BellaOnline | Privacy Policy | Advertising | Become an Editor |
Website copyright © 2008 Minerva WebWorks LLC. All rights reserved.


BellaOnline Editor