+ Start a Discussion

System.TypeException: Invalid long: 200410100505000132202606152714

I need to convert a String of this length to any type of number.

But Long is not powerful enough to contain that.

What can I do?
Om PrakashOm Prakash
I suggest to use Decimal
String StrValue = '200410100505000132202606152714';
Decimal decimalValue = Decimal.valueOF(StrValue);
Thanks but I have another problem.
Acually I need to make a modulus with that value, but modulus operation is not available for Decimal.
In fact, I want to write an algorithm to validate an IBAN account.

So if we refere to my example , I need to do 200410100505000132202606152714 mod 97

Mod is not possible with Decimal.
Mod is possible with Long, but Long cannot hold the value.
I'm stuck
Om PrakashOm Prakash
Got it.
​Mod method is not available for decimal so still we couldn't resolve this issue.
I have exactly the same issu for IBAN manipulation today. Do you found a solution since march ?
I managed to validate the IBANs in the end.
I have provided solution here :

Matias CalvoMatias Calvo
Hello guys

We have a free application in the Appexchange that does a real IBAN (and others) validation without any Apex code and is updated including the newly supported countries every release.

Check this out: https://goo.gl/HHZ4c3

I hope this helps you and give us feedback to improve it.