Check for integer

YoDoug
✭
I have a situation where I need to check to see if a calculated num value is an integer. I am struggling to find an easy way to do this. Suggestions?
0
Comments
-
Hello,
:=(Trunc(
<code>numValue
)=<code>numValue
);
<code>bIsInt
☑️2024 - RobotStudio® User Group0 -
Try NumToStr, then StrMatch for a ".", the decimal.Lee Justice0
-
Hello,
RAPID offers the instruction "TryInt" to check if a number is an integer.<p>VAR num myint := 5.2;</p><p><br></p><p><b>TryInt</b> myint;<br></p><p>ERROR<br></p><div><p>IF ERRNO = ERR_INT_NOTVAL THEN</p><p><br></p><p> myint := Round(myint);</p><p><br></p><p> RETRY;</p><p><br></p></div><div><p><span>ENDIF<br></span></p></div>
/BR
Micky1
Categories
- All Categories
- 5.6K RobotStudio
- 398 UpFeed
- 20 Tutorials
- 14 RobotApps
- 300 PowerPacs
- 406 RobotStudio S4
- 1.8K Developer Tools
- 250 ScreenMaker
- 2.8K Robot Controller
- 336 IRC5
- 67 OmniCore
- 8 RCS (Realistic Controller Simulation)
- 828 RAPID Programming
- 12 AppStudio
- 4 RobotStudio AR Viewer
- 19 Wizard Easy Programming
- 107 Collaborative Robots
- 5 Job listings