FUNCTION StringToInteger LPARAMETER pcstring, plsigned LOCAL lnresult, lnlast, lni, llsigned,; lnmsb, lnmax lnresult = 0 lnlast = LEN(pcstring) * Return Signed Integer? IF PCOUNT() = 2 llsigned = plsigned ELSE llsigned = .F. ENDIF FOR lni = 1 TO lnlast lnresult = lnresult + ASC(SUBSTR(pcstring, lni, 1)) * (256 ^ (lni - 1)) NEXT IF llsigned lnmsb = (lnlast * 8) - 1 IF BITTEST(lnresult, lnmsb) lnmax = (2 ^ (lnmsb + 1)) lnresult = lnresult - lnmax ENDIF ENDIF RETURN lnresult ENDFUNC * Usage lnlinestat = StringToInteger(LEFT(lpStatus, 1)) lnbattflag = StringToInteger(SUBSTR(lpStatus, 2, 1)) lnbattpct = StringToInteger(SUBSTR(lpStatus, 3, 1)) lnreserved = StringToInteger(SUBSTR(lpStatus, 4, 1)) && Not really necessary lnlifetime = StringToInteger(SUBSTR(lpStatus, 5, 4)) lnfulllife = StringToInteger(RIGHT(lpStatus, 4))