function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Data Migration 5Data Migration 5 

how to extract the file extension into an custom field

I have a custom field that stores complete file name. Is there any way to extract the file extension (like .ppt,.pdf etc) and populate the extension in another custom field?
GauravTrivediGauravTrivedi
You can use this 
List<Attachment> ata= [SELECT Name FROM Attachment];
for(Attachment a : ata){
    String nameField = a.Name;
    if(nameField.Contains('.'))
    	system.debug(nameField.substringAfter('.'));
}

Let me know if your problem is resolved.
rkris320rkris320
This helped me. thanks