A colleague of mine made this little function.
It strips leading 0's in a string.
The string may only be a 1000 characters long, but that can be modified by changing 1000 to an other value.
static TempStr strLtrim0(TempStr txt,str 1 trim = '0')
{
int i = strNfind(txt,trim,1,1000);
return i ? subStr(txt,i,1000) : '';
}
It strips leading 0's in a string.
The string may only be a 1000 characters long, but that can be modified by changing 1000 to an other value.
static TempStr strLtrim0(TempStr txt,str 1 trim = '0')
{
int i = strNfind(txt,trim,1,1000);
return i ? subStr(txt,i,1000) : '';
}
Hi,
ReplyDeleteusing strings in x++ normally sized 1000 chars,
but there are exceptions...
http://www.crazy-club.de/blog/2010/03/secrets-of-datatype-string/
Hi,
ReplyDeleteYou can use TrimStart for this as well.
Like this:
System.String myString2Trim="0000123-456-000-789";
System.String trimChars="0";
;
info(myString2Trim.TrimStart(trimChars.ToCharArray()));
(PS: Like your blog!)
Regards,
Willy (blog at http://dynamics-ax-live.blogspot.com)