Operators... *sigh*

1. Senior Member
Join Date
Dec 1969
Posts
121

## Operators... *sigh*

I&#039;m trying to add two numeric strings, in order to get a &#039;total-value&#039;,<BR>but asp concenates the strings if the + sign is in between two strings, therefore, I created this solution:<BR>&#060;%<BR>&#039;value = 5<BR>&#039;oldvalue = 4<BR><BR>rating = 1 + (request("value") + 1 + request("oldvalue")) - 2<BR><BR>&#039;rating = 9<BR>%&#062;<BR>Which works, (beacause there are numeric expressions between the strings) but it seems inefficient to add numeric expressions and then subtract them from the total..?<BR><BR>Is there another (less confusing) way to ADD, not Concenate two strings?

2. Senior Member
Join Date
Dec 1969
Posts
206

## RE: First of all...

There are no strings or integer or anything else in VBScript. Only Variant Type.<BR>Second, you could try casting and see if it works:<BR>&#060;%<BR>Dim a, b<BR>a=6<BR>b=7<BR>Response.Write Cint(a)+Cint(b)<BR>%&#062;

3. Senior Member
Join Date
Dec 1969
Posts
7,686

## RE: Operators... *sigh*

depending on the type of the value, you do<BR><BR>CINT(stringval)<BR>CDBL(stringval)<BR>CL NG(stringval)<BR><BR>where CDBL is the most commonly used. This converts the stringval to an Double.

4. Senior Member
Join Date
Dec 1969
Posts
121

## ...obviously :) <eop>

empty

#### Posting Permissions

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