How to Count the no of coma seprated values using Apex in Salesforce? May 24, 2019June 9, 2022Magulan Duraipandian Sample Code: String str = ‘a,b,c,d,e’; system.debug( ‘Count is ‘ + str.split( ‘,’ ).size() ); Output: