how do you get the first value of a integer?

# Thread: how do you get the first value of a integer?

1. Senior Member
Join Date
Dec 1969
Posts
179

## how do you get the first value of a integer?

i have a variable which is any number from 01 - 99. what is the vb script function for "if the variable is 01,02,03etc as in starts with a zero, then change to just 1,2,3 etc..<BR><BR>Prompt help would be much appreciated :-)

2. Senior Member
Join Date
Dec 1969
Location
Los Angeles, CA
Posts
21,192

## Why get into all that

just convert it BEFORE you check<BR><BR>

3. Senior Member
Join Date
Dec 1969
Posts
11,334

## RE: how do you get the first value of a integer?

myVar = Int(yourNumber)<BR><BR>Was that prompt enough for you?

4. Senior Member
Join Date
Dec 1969
Posts
179

## RE: Why get into all that

yes how do i convert it - i NEED to do the zero thing

5. Senior Member
Join Date
Dec 1969
Posts
179

## dont get that...

...i have<BR><BR>Dim nearlySite<BR> If makingSite &#062; 5000 then <BR> nearlySite=mid(makingSite,3,2)<BR> ElseIf makingSite &#060; 0 then<BR> response.write "there is an error with the site choice"<BR> Else nearlySite = makingSite<BR> End If<BR>Response.Write nearlySite<BR>Dim whatSite<BR>If nearlySite (which can be 01,02,21,25) begins with a zero truncate to 1,2,3 else leave the number as it is (11, 21, 25)<BR><BR>explained any better?<BR>boy i can&#039;t seem to do it

6. Senior Member
Join Date
Dec 1969
Posts
11,334

## RE: dont get that...

If CInt(nearlySite) = whatever<BR><BR>this statement will truncate your 0. Then just do a compare...<BR><BR>If CInt(nearlySite) = 2 Then &#039;this will pass if your value was 02

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•