cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Rincewind
Level 3

StrToNum is broken?

I have some code to check the sub-version number of the installed Java by stipping the number from the end of the install path (retrieved from the registry). However, the StrToNum function is returning zero. Here is the code:

STRING szJavaHome, szJavaDir, szJavaVer;
NUMBER nJavaVer;
BOOL bGoodJava;
if (StrLength(szJavaHome) > 1) then
if (ParsePath(szJavaDir,szJavaHome,FILENAME) = 0) then
if (StrSub(szJavaVer,szJavaDir,StrFind(szJavaDir,'_')+1,2) = 0) then
if (StrToNum(nJavaVer,szJavaVer) = 0) then
if (nJavaVer >= 26) then
bGoodJava = TRUE;
endif;
endif;
endif;
endif;
SprintfBox(INFORMATION,"","%s\n%s\n%s\n%ld",szJavaHome,szJavaDir,szJavaVer,nJavaVer);


The result is:
C:\Program Files (x86)\Java\jdk1.6.0_26
jdk1.6.0_26
26
0

Obviously, the StrToNum function is failing, but I can't tell why.
Labels (1)
0 Kudos
(2) Replies
RobertDickau
Flexera Alumni

StrSub doesn't return 0 for success, so maybe the inner StrToNum just isn't being called?
0 Kudos
Rincewind
Level 3

Oops, teach me to read the documentation.
Guess that should be >0.
Thanks Robert.
0 Kudos