Skip to main content

Posts

Showing posts with the label How to remove special characters from string in axapta

How to remove special characters from string in MSD axapta

To remove special characters from string in axapta you can try following code . static void formatedString(Args _args) { str StringVal = “ Hello \tSumit \n Dear”; str replace(str _sourceStr, str _what, str _with) { int found = 0; str target = _sourceStr; ; do { found = strscan(TargetStr, _what, found, strlen(TargetStr)); if (found != 0) { TargetStr = strdel(TargetStr, found, strlen(_what)); TargetStr = strins(TargetStr, _with, found); found += strlen(_with); } } while (found != 0); return TargetStr; } ; StringVal = replace(StringVal, ‘\n’, ”); StringVal = replace(StringVal, ‘\r’, ”); StringVal = replace(StringVal, ‘\t’, ”); StringVal = replace(StringVal, ‘ ‘, ”); info(StringVal); }