Concretio

View Original

Tip: Using Decimal class with Strings in Apex

Today I came across an interesting problem that reminded me of my Java days. A piece of Apex code written by some other developer was broken, when I did my fixes.

Here is some background about the broken code, lets say the file name is “ScaryMovie.cls

  • It tries to query a Number(18, 0) field from Sobject, lets say sobject is Mock__c, and number field is “Counter__c

  • Appends the number field to a String to create a URL

Read More: https://abhinav.fyi/tip-using-decimal-class-with-strings-in-apex/