DocSF

DocSF

Did You Know?

We design Docy for the readers, optimizing not for page views or engagement

Salesforce Apex Add Characters left string

Suppose we create a string like

00025
00026
00027

We don’t have to use an autocounter

We have incremental numbers.

We transform it into a string

Integer iCounter = Integer.valueof(sCounter);
iCounter ++;
        
sCounter = String.valueOf(iCounter );

we will have a similar result to

26
27

Now we want to create a 5-character string where on the left we have zeros

sCounter.leftPad(5, '0')

Apex Guide leftPad

Related Post

Files .properties in commerce cloud

In commerce cloud si trovano dei file che hanno come es...

Non vedo gli aggiornamenti su Field Sarvice d

Se stai lavorando sulla App di Field Service e modifich...

Salesforce Visualforce campo hidden

<apex:inputHidden id="hdnDocName" value="{!filename}...