convert string to integer

Post Reply
sourceuno
Posts: 225
Joined: Mon Apr 09, 2001 3:58 pm

convert string to integer

Post by sourceuno »

How do I convert a string to an integer in order to perform some integer arithmetic? When I use the following statements, the $newval variable equals 455. Why doesn't it equal 45?

<$intValue=500>
<$str="tagid=455">
<sandr "tagid\==" "" $str>
<$newval=($ret - $intValue)>
$newval
User avatar
John
Site Admin
Posts: 2622
Joined: Mon Apr 24, 2000 3:18 pm
Location: Cleveland, OH
Contact:

convert string to integer

Post by John »

The result of the <sandr> is a string. You can convert
it to an integer in your expression as follows:

<$newval=(convert($ret, 'int' ) - $intValue)>

There is also the <strtonum> function in vortex which will convert strings in many formats into numbers.
John Turnbull
Thunderstone Software
Post Reply