Data Type Conversion for TargetRect values

There’s something simple that I’m not understanding about data type conversions. Need a little help.
Trying to set the width and height of a text rectangle. Harcoding the numbers works, however, now I need to set the width and height from variables.
According to the docs (and testing) I have to first convert my variables to integer type. I tried appending a “%” to my variables but still get Data Type Conversion errors.

I get a value from my xml file…
rectWidth = xml.text_rectW.getText()
rectWidth is now 500

however, its still a string data type
how do I convert this to an integer so I can set my textbox rectangle width? Becuse this does not work…

rectWidth% = xml.text_rectW.getText()
rectHeight% = xml.text_rectH.getText()

mytext =
mytext.Push({
Text: “some text to help make you boogie all night long with all the ladies”
TargetRect: { x:10, y:10, w: rectWidth%, h: rectHeight% }
})

the text displays fine but the text rectangle is the whole width and height of the screen.

You can convert a string to an int with ToInt() http://sdkdocs.roku.com/display/RokuSDK … ToIntAsInt
or StrToI() http://sdkdocs.roku.com/display/RokuSDK … gAsDynamic

BrightScript Debugger> ? type("5".ToInt())
Integer
BrightScript Debugger> ? type(StrToI("5"))
Integer

Awsome, thanks!
strtoi() worked for me. My example:

rectW = xml.text_rectWidth.getText()
rectW = strtoi(rectW)

Now I can set my text rectangle width, height and also XY coords. Thanks again. :grinning_face_with_smiling_eyes: