You need to extract the last three characters from the string value of 122018 by using X++ code.
Which two code segments achieve this goal? Each correct answer presents a complete solution.
A. = substr(‘122018’, 0,3)
B. = substr(‘122018’, 4,3)
C. = substr(‘122018’, 6,-3)
D. = str2num(‘122018’, 3)
E. = str2num(‘122018’, -3)
Correct Answer: BC
Explanation/Reference:
Subst retrieves part of a string.
str subStr(str _text, int _position, int _number)
Parameters:
_text
The original string.
_position
The position in the original string where the part to retrieve begins.
_number
A signed integer that indicates the direction and number of positions to retrieve from the original string.
If there is a minus sign preceding _number, the system selects the substring backward from the specified position.
Incorrect:
Not d, not E: str2Num converts a string to a real number.
Syntax: real str2Num(str _text)
Reference: subStr Function [AX 2012]