StrToInteger

Back to topics list To post a new topic, please log in or register
avatar
50
parham.trader 2015.10.09 15:42
 

Hi friends,

 When I want to use StrToInteger or StringToInteger functions it results to -1 .

does anyone know about the problem ? how can I fix this issue ?

thank you all 

avatar
12985
WHRoeder 2015.10.09 16:12 #
 
parham.trader:

When I want to use StrToInteger or StringToInteger functions it results to -1 .

does anyone know about the problem ? how can I fix this issue ?

  1. No it doesn't
     void OnStart()
      {
      string s = "-123";
      int    i = StrToInteger(s);
      PrintFormat("s='%s' i=%i", s,i);
    // 2015.10.09 10:09:22.101    testscr AUDUSD,H4: s='123' i=123
    // 2015.10.09 10:10:06.869    testscr AUDUSD,H4: s='-123' i=-123
    }
    
  2. Print your variables and show us your code and output.

avatar
50
parham.trader 2015.10.09 16:47 #
 

thank you ,

it is solved, I found out that the size of my number was bigger than what is permitted for an int type.(even for long or ulong ones)

 

Back to topics list  

To add comments, please log in or register