Ask a Question

How to Retrieve an Integer from a StyledText object?

BrandonH
Contributor

How to Retrieve an Integer from a StyledText object?

Hi,

 

     I have a few instances where an integer is stored in SWTObject(StyledText).  I don't seem to be able to read the integer from this object with the available methods.  Can someone provide a JavaScript example?

 

Thanks,

2 REPLIES 2
shankar_r
Community Hero

Hi,

 

Not sure how the control look likes, but you can try getString(), getName() function from your StyledText object.

 

If above doesn't helps, Share some snapshots of Object and its properties and methods


Thanks
Shankar R

LinkedIn | CG-VAK Software | Bitbucket | shankarr.75@gmail.com

“You must expect great things from you, before you can do them”

Extension Available

pramoddn
Occasional Contributor

if i understood correctly, then the question is on Type Casting, if so, get the text first SWTObject(StyledText), via getText() or object.ContetnText

 

 

stringContent = object.contentText()

intContent = parseint(stringContent)  //in Java script, if VB Script use cint(stringContent)

 

intContent will contain the integer.

 

If the requirement is to fetch partial text like "content_001" then we have to make use of substring and then type casting.

cancel
Showing results for 
Search instead for 
Did you mean: