Please review the following salesforce trigger codetrigger BrandTrigger on Brand__c (before update) {    for(Brand__c brand: Trigger.new){        Brand__c oldBrand = Trigger.oldMap.get(brand.Id);        if (oldBrand.Name != brand.Name) {            if(String.isBlank(oldBrand.Old_Name__c)){                brand.Old_Name__c = oldBrand.Name;            }else{                brand.Old_Name__c = split(oldBrand.Name + ', ' + brand.Old_Name__c );            }        }    }    private String split(String s) {        Integer index = 0;        for (Integer i = 0; i < 3; i++)            index = s.indexOf(', ', index + 1);        if(index > 2)            return s.substring(0, index);        else            return s;    }}Trigger sets at least three values in the Old Value field. These are the historical values of Brand_c.Name
Last three values sfdc trigger functionalty
salesforce apex