Another Salesforce blog!!!

Salesforce, Apex

Extract substring from a string until finds a comma c#

substring = str.Split(‘,’)[0];


You can use IndexOf() to find out where is the comma, and then extract the substring. If you are sure it will always have the comma you can skip the check.



Leave a Reply

Your email address will not be published. Required fields are marked *