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
rv90rv90 

String Contains Sub String from right

In the Physical County i will be getting string such as 'Wayne County' or 'Oakland County' so my requirement is to remove the county and just update as 'Wayne'  or 'Oakland' Below code is working fine, but i need to check if physical_county__c contains 'County' string onky from the right side that is if we have last 6 sub string as County then enter the IF condition.. Can any one help me out on this. 

Below is my code, 
IF(fa.Physical_County__c.contains('County')){
fa.Physical_County__c = fa.Physical_County__c.substring(0,fa.Physical_County__c.length()-6);