CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 Formatting A Number Into A String

Print topic Send  topic

Author Message
Suntower

Posts: 225
Posted: 01/11/2008, 2:35 PM

Can someone give me an idea of how to format an integer into a two-digit string as follows:

"07"
"08"
"09"
"10"
"11"
"12"

I want to create a list of strings like:

IMPRINT01
IMPRINT02
IMPRINT03

...etc...

TIA,

---JC

_________________
---On a campaign for more examples and better docs!
View profile  Send private message
JimmyCrackedCorn

Posts: 583
Posted: 01/11/2008, 2:58 PM

if Len(CStr(myInteger)) = 1 then  
     myString = "IMPRINT0" & myInteger  
else  
     myString = "IMPRINT" & myInteger  
end if

(you don't even really need CStr)
_________________
Walter Kempees...you are dearly missed.
View profile  Send private message
Edd


Posts: 547
Posted: 01/13/2008, 8:22 PM

Single line method:

  
mystring = "IMPRINT" & Right("00" & CStr(myInteger), 2)  

Cheers - Edd

_________________
Accepting and instigating change are life's challenges.

http://www.syntech.com.au
View profile  Send private message
Suntower

Posts: 225
Posted: 03/06/2008, 11:40 AM

I love it. CS101. I guess I'd assumed that VB had this sort of thing built in since it's so rich in other doodads.

Cheers,

---JC

Quote Edd:
Single line method:

  
mystring = "IMPRINT" & Right("00" & CStr(myInteger), 2)  

Cheers - Edd


_________________
---On a campaign for more examples and better docs!
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.