Get Label For SObject API Name
You can get the label using the DescribeSObjectResult
:
DescribeSObjectResult describe = SObjectType.MyApiName__c;
system.debug(describe.getLabel());
Another common syntax is:
DescribeSObjectResult describe = MyApiName__c.sObjectType.getDescribe();
You can also just one-line it:
system.debug(SObjectType.MyApiName__c.getLabel());