Shop OBEX P1 Docs P2 Docs Learn Events
Lockup Using ToInteger more than once — Parallax Forums

Lockup Using ToInteger more than once

nrandalnrandal Posts: 5
edited 2011-09-12 09:04 in Accessories
The first conversion of a string to an integer works perfectly. The second attempt locks the server up.
PRI SetTime(id) | temp, seconds, minutes, hour, day, date, month, year
  temp := Request.Get(id, @qYear)
  year := ToInt(temp) #> 2011 <# 2020

  temp := Request.Get(id, @qMonth)
  month := ToInt(temp) #> 1 <# 12

  temp := Request.Get(id, @qDate)
  date := ToInt(temp) #> 1 <# 31

  temp := Request.Get(id, @qDayWeek)
  day := ToInt(temp) #> 1 <# 7

  temp := Request.Get(id, @qHour)
  hour := ToInt(temp)  #> 0 <# 23

  temp := Request.Get(id, @qMinutes)
  minutes := ToInt(temp)  #> 0 <# 59

  temp := Request.Get(id, @qSeconds)
  seconds := ToInt(temp)  #> 0 <# 59

PRI ToInt(strPtr) : int | ndx

  if strPtr == 0
    return 0
    
  bytemove(@numBuff, strPtr, strsize(strPtr) <# 10)
  int := str.ToInteger(@numBuff)
  bytefill(@numBuff, 0, 10)

Comments

  • Mike GMike G Posts: 2,702
    edited 2011-09-12 09:04
    The issue with the StringMethods object has been fixed by nrandal on 9/11/2011. Updated code can be found in the Google code repository. Thanks for the contribution nrandal :)
Sign In or Register to comment.