Posts

Showing posts with the label First

Salesforce Fact #601 | first in apex:repeat

Image
There is an attribute named 'first' in apex:repeat which works similar to offset in SOQL. The number specified in the offset is equal to the number of rows which will be skipped. Reference:  https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_repeat.htm Attached are the screenshots.

Salesforce Fact #600 | Remove first and last occurrence of char from string

Image
There is a method named substringBeforeLast() in String class which is helpful in getting the substring before last occurrence of a particular character. Suppose, we wrapped a particular string with a particular char at the start and also at the end. Now, to get the exact string we need to remove the very first and very last occurrence of that char.  substringBeforeLast() method along with the substring() method could be handy here. Attached is the screenshot.