Don´t know how to submit a bug, so I posted here.
It would be nice to understand why does this happen (just for curiosity).
Output of the CInt() function for some arbitrary strings that commence with zero:
CInt("01") = 1
CInt("02") = 2
CInt("03") = 3
CInt("04") = 4
CInt("05") = 5
CInt("06") = 6
CInt("07") = 7
CInt("08") = 0
CInt("09") = 0
CInt("010") = 8
CInt("011") = 9
(...)
CInt("018") = 1
CInt("019") = 1
CInt("020") = 16
(...)
CInt("028") = 2
The result is the same no matter how many zeroes are ahead.
Essentially, for 0-7 ones the result is "the number - (tens * 2) " and for 8-9 ones the result is the number of tens.
CInt()
Moderator: POL Developer
Re: CInt()
If you start a string with 0x it is base-16
If you start a string with 0 it is base-8
What you are seeing is, Octal.
In one you have 028, but 8 cant be there, so it goes 02 and gives you 2
If you start a string with 0 it is base-8
What you are seeing is, Octal.
In one you have 028, but 8 cant be there, so it goes 02 and gives you 2
-
- New User
- Posts: 19
- Joined: Wed Sep 15, 2010 9:47 pm
Re: CInt()
Haha, sorry for my ignorance.
I´ll keep it in mind in case I lose two fingers.
I´ll keep it in mind in case I lose two fingers.
Re: CInt()
If you have strings coming up, (this isnt the best way to do it, just the easiest off memory) and you need to remove leading 0s
Code: Select all
while ( text[0] == "0" )
text[0] :="";
Sleepms(2);
endwhile
-
- Distro Developer
- Posts: 2825
- Joined: Thu Feb 02, 2006 1:41 pm
- Location: San Antonio, Texas
- Contact:
Re: CInt()
I wasn't aware of this either Austin. Is this the "standard" behaviour of CInt() in other languages? Either way it might be a good idea to update Racalac's eScript guide in the Documents section to indicate this?
Thanks.
Thanks.
Re: CInt()
Its been the case since... forever. Yes, Rac's guide does need some updating so people know about the awesomeness that is _var_iter in a foreach loop.
-
- Distro Developer
- Posts: 2825
- Joined: Thu Feb 02, 2006 1:41 pm
- Location: San Antonio, Texas
- Contact:
Re: CInt()
Hahahaha!
Oh yeah!
Oh yeah!