Return the last nine characters of a string

Hi,

I have a string like this:NL20INGB0007121497

And I just want to get the last nine characters of that string.

I try it like this:

MyString := CustomerBankAccount.Code;// (IBAN);

hallo := MyString2.GETSUBTEXT(SubText,1,STRLEN(MyString)-9);

MESSAGE(FORMAT(hallo));

where:

MyString= text

MyString2 = Bigtext

hallo = integer

Thank you

hi,

Try This

MyString := ‘ANjdsuisf123456789’;

Evaluate(hallo,COPYSTR(MyString,STRLEN(MyString)-8,STRLEN(MyString));

Message(’%1’,hallo);

Small Suggestion Why You Want To Convert Or Store string Again into Number .

Avoid It let it be string/text is ok…if you convert and If first Number is Zero then it would Neglect zero…

Thank you. Very nice.

But I have it now like this:

CustomerBankAccount.Code := (IBAN) ; // FORMAT( CustomerBankAccount.IBAN);

// MyString := ‘ANjdsuisf123456789’;

EVALUATE(hallo,COPYSTR((IBAN),STRLEN( (IBAN))-8,STRLEN( (IBAN))));

MESSAGE(’%1’,hallo);

Because there is a datavase field CustomerBankAccount.Code

And the actual bank acoount number is from a XML file, with the propertie: IBAN. So the IBAN number has to be striped and goes in to the CustomerBankAccount.Code field.

But I get now the error:

Overflow tijdes typeconversie van Text naar Code: Waarde is:Nl41ingb0006618174

Ah, I have it now like this:

IF STRLEN(MyString) >= 9 THEN
  MyString2 := COPYSTR(MyString,STRLEN(MyString)-8,9);
And it works like a charm!!