PDA

View Full Version : Converting a String to an Integer



d2_s
04-03-2006, 01:10 AM
Is it possible a string into an integer via a setup builder function?

I am looping through a list of files and for each file and setting the size via the "ScriptItem->Get File Information( File Size )" function however return value is actually a String and not an integer. I am using a variable called %TOTAL_FILE_SIZE% intialised to zero to store the cumulative total ... however instead of adding integers it is doing a string concatenation.

For example:
Say I am adding the size of 3 files, 1 is 100 bytes, 2 is 300 bytes and 3 is 550 bytes. Instead of giving me a total of 950 bytes it gives me a result "0 + 100 + 300 + 550". Is there any way to convert a string to an integer or to get the variable to treat this calculation as integer addition and not string concatenation?

Thanks

linder
04-03-2006, 01:14 AM
Hello,

Would it be possible for you to send a small demo script to support (at) lindersoft (dot) com?

Thanks,

linder
04-03-2006, 01:16 AM
Re-read your message. Do you use the "Evaluate Expression" operation in your Set Variable function?

Thanks,

d2_s
04-03-2006, 05:20 PM
Re-read your message. Do you use the "Evaluate Expression" operation in your Set Variable function?

Thanks,

Thank goodness for you help Friedrich :)

Turns out I didn't have the "evaluate expression" option selected. All is well now. Thankyou again!

d2_s
04-03-2006, 08:17 PM
-