nerdexam
Microsoft

MB6-704 · Question #61

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.

The correct answer is B. = substr('122018', 4,3) C. = substr('122018', 6,-3). Subst retrieves part of a string. str subStr(str _text, int _position, int _number) The original string. The position in the original string where the part to retrieve begins. A signed integer that indicates the direction and number of positions to retrieve from the original If…

Develop X++ code

Question

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.

Options

  • A= substr('122018', 0,3)
  • B= substr('122018', 4,3)
  • C= substr('122018', 6,-3)
  • D= str2num('122018', 3)
  • E= str2num('122018', -3)

How the community answered

(65 responses)
  • A
    3% (2)
  • B
    77% (50)
  • D
    8% (5)
  • E
    12% (8)

Explanation

Subst retrieves part of a string. str subStr(str _text, int _position, int _number) The original string. The position in the original string where the part to retrieve begins. A signed integer that indicates the direction and number of positions to retrieve from the original If there is a minus sign preceding _number, the system selects the substring backward from the specified position. Not d, not E: str2Num converts a string to a real number. Syntax: real str2Num(str _text)

Topics

#substr function#string manipulation#X++ string functions#negative index

Community Discussion

No community discussion yet for this question.

Full MB6-704 Practice