How to Copy String using COPYSTR Function in D365 BC

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.

Copy String using COPYSTR Function in Business Central

(5) After that, run the codeunit, and we will get the response is → Business Central.


Types of License in Business Central D365
Creation of Production BOM in Business Central
Difference between CALCFIELDS and SETAUTOCALCFIELDS Function in D365 BC
Update Item Ledger Entry fields at the time of Purchase Receipt Posting in D365 BC
How to create Bank Account Master in Business Central
How to Create Contra Voucher in D365 BC
Publishing and Installing an Extension– Microsoft Docs

Leave a Reply