Copy String using COPYSTR Function in D365 BC:
(1) In this blog, we will get to know about the use of the COPYSTR function in D365 BC. It copies a substring of any length from a specific position in a string to a new string.
(2) Syntax of COPYSTR:
|NewString := COPYSTR(String, Position[, Length])|
(3) Note: If Position combined with Length exceeds the length of the string, all the characters from Position to the end of the string are returned.
(4) Now let’s take an example and see the result. In this example, we declare two variables, the First Variable stores the original value, and the Second Variable stores the result after using the COPYSTR function. It copies the string from the first Position → 1 and copies the values according to the Length → 16 as shown.
(5) After that, run the codeunit, and we will get the response is → Business Central.