Remove Prefix from a String in D365FO
Code to remove any specified prefix from a string value. (Example: Remove '0' from '000018743')
public static str stringWithoutPrefix(str _strValue,str _prefixToRemove)
{
str s1 = _strValue;
str s2 = _prefixToRemove;
int i = 0;
int whereFound;
for(i= 0; i < strlen(s1); i++)
{
whereFound = strnFind(s1, s2 , 1, strLen(s1));
if(whereFound > 1)
{
s1 = strdel(s1,1,1);
}
}
return s1;
}