I have not found the trim function of the string in axapta for a long time. I wrote one using strfind and substr. There should be a better implementation method. Let's use it together first.
Static Void Strtrim (ARGs)
{
Int Position;
STR srcstr;
;
Srcstr = " AAA aaa " ;
Position = 1 ;
// Left trim
While ( True )
{
Position = Strfind (srcstr, " " , 1 , 1 );
If ( ! Position)
Break ;
Srcstr = Substr (srcstr, position + 1 , Strlen (srcstr) - Position );
}
// Right trim
While ( True )
{
Position = Strfind (srcstr, " " , Strlen (srcstr ), 1 );
If ( ! Position)
Break ;
Srcstr = Substr (srcstr, 1 , Position - 1 );
}
Print srcstr;
Pause;
}
Note:
Today, the strltrim and strrtrim functions are found in system document> functions. The common system function explanations are all put here. It is quite useful to have a look at them. Static Void Strtrim (ARGs _ ARGs)
{< br> str aa = " AA " ;< BR >;< br> AA = strltrim (AA);
AA = strrtrim (AA);
Print AA;
pause;
}