I know that you can get all label names of picklist with the following code.
Schema.DescribeFieldResult fieldResult = Account.PicklistField__c.getDescribe();
List<Schema.PicklistEntry> values = fieldResult.getPicklistValues();
for( Schema.PicklistEntry v : values) {
System.debug('Picklist Value Label:' + v.getLabel());
System.debug('Picklist API Name:' + v.getValue());
}
Is there a way to get just the label of the specified API reference name? In addition to the following
Schema.DescribeFieldResult fieldResult = Account.Ownership.getDescribe();
List<Schema.PicklistEntry> values = fieldResult.getPicklistValues();
String result;
for( Schema.PicklistEntry v : values) {
// System.debug('Picklist Value Label:' + v.getLabel());
System.debug('Picklist API Name:' + v.getValue());
if (v.getValue() == 'public') {
result = v.getLabel();
}
}