Remove string after/before special character in D365fo X++
static void RemoveStringAfterSpecialChar(Args _args) { CustTable custTable; while select * from custTable { str dataWithSpecialChar; str dataBeforeSpecialChar; dataWithSpecialChar = custTable.myStringField; // Replace 'myStringField' with your actual field name. // Find the position of the special character (e.g., "-" in this example). int specialCharPos = strScan(dataWithSpecialChar, "-", 1, strLen(dataWithSpecialChar)); if (specialCharPos > 0) { // Extract the part of the string before the special character. dataBeforeSpecialChar = subStr(dataWithSpecialChar, 1, specialCharPos - 1); } else ...