String into variable

Basic question but how to convert a string into a usable variable. They way this macro work is open an image file; read a text file of the same name, where metadata is stored and get the pixel size. I want to subtract that pixel size by 1000 to have um and use it in “set scale”. Everything works except for dividing by 1000. I’m writing in ij1 macro.

path = File.openDialog("Select a File");
open(path);
dir = File.getParent(path);
name = File.getNameWithoutExtension(path);
txt = File.openAsString(dir+"\\"+name+".txt");
PixelSize = substring(txt, indexOf(txt, "PixelSize="), indexOf(txt, "SignalName"));
PixelSize = replace(PixelSize,"PixelSize=","");
PixelSize = replace(PixelSize,"\n","");
print(PixelSize)
um = 1000;
PixelSize = PixelSize / um ;
run("Set Scale...", "distance=1 known=PixelSize unit=nm");
print(name);
print("Imagescale: 1 pixel = "+PixelSize+" nm");
//print(ImageSize);

parseFloat(string)
Converts the string argument to a number and returns it. Returns NaN (Not a Number) if the string cannot be converted into a number. Use the isNaN() function to test for NaN. For examples, see ParseFloatIntExamples.

Thank you; it worked. I did it like this:

PixelSize = parseFloat(PixelSize)
PixelSize /=1000

For some reason “parseFloat(PixelSize)” prints out the digit.

PS. hmmm single line works also: PixelSize = parseFloat(PixelSize)/1000, which is a bit strange.