Search code examples
microsoft-dynamicsnavision

microsoft navision 2009, how to get the last nine characters


I have a string like this: Nl41ingb0006618174

And I want to return only the last nine characters.

I try it like this:

MyString := (IBAN);
MyString2.GETSUBTEXT(MyString, 1,TextPos-9);
MESSAGE(FORMAT(MyString2));

where IBAN = bank account number

MyString2 = bigtext

MyString = Text

Solution

  • You should do it via COPYSTR + STRLEN:

    IF STRLEN(MyString) >= 9 THEN
      MyString2 := COPYSTR(MyString,STRLEN(MyString)-8,9);