Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
convert string to long integer
#1
Hi,
I've been struggling with this and I am sure there must be a simple solution I am just missing. 

When converting a string of digits to an integer, if the converted integer is greater than 2147483647 the resulting integer is a negative number.   I realize this has to do with the limit of a type 'int', but I can't understand what type to use to get a value that can than be used in equations.  I typed with type LONG but I get the same result as type INT.

Example. 
str text="2561214621"
int sVal=val(text)
out sVal
-1733752675   (need this to be 2561214621 or in some other notation that can be used in calculations)

this works fine: 

str text="2023292291"
int sVal=val(text)
out sVal
2023292291

My overall problem is that the string could be a string of digits from 0 to 10,000,000,000 and I need to make calculations on the converted numbers.  

Any help is greatly appreciated.
Jim
#2
str text="2561214621"
long sVal=val(text 1)
out sVal
#3
thanks. Should have seen I was missing the type :-(


Forum Jump:


Users browsing this thread: 1 Guest(s)