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
Sudhir NarayanswamySudhir Narayanswamy 

Split String

Hi, 

  I have a requirement where user will pass APG-374-NN223-F1 I need to split the string each after - and assign this to a variable to inset into a different custom field Please suggest me how to implement this feature using apex. 

Thanks
Sudhir
PawanKumarPawanKumar
Hi ,

String yourValue='APG-374-NN223-F1';
String[] splittedArray = yourValue.split('-');
for(String eachSplittedValue : splittedArray ){
// set your field here.
}

Regards,
Pawan Kumar
PawanKumarPawanKumar
Please let me know if it works for you.