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.5K RobotStudio
- 396 UpFeed
- 18 Tutorials
- 13 RobotApps
- 297 PowerPacs
- 405 RobotStudio S4
- 1.8K Developer Tools
- 250 ScreenMaker
- 2.8K Robot Controller
- 314 IRC5
- 59 OmniCore
- 7 RCS (Realistic Controller Simulation)
- 794 RAPID Programming
- AppStudio
- 3 RobotStudio AR Viewer
- 18 Wizard Easy Programming
- 105 Collaborative Robots
- 5 Job listings