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
JP BlonshineJP Blonshine 

Convert a string to multiple records

Hey All -

 

I am not really sure where to begin on this. I have two long text fields: CF and CV. They both reside in Test_Data__c a child object of Test__c. 

Example:

CF = '0.1:0.2:0.3:etc.....'

CV = '0.0:0.4:0.2:etc...'

 

As you can see, each value is seperated by a colon. For each CV there is a CF. So the end goal here is to create a record that contains the Integer of CF2 and CV2 and relate it to the original Test__c master record.

 

To be more specific, I need to create a list of records from the two long text areas in each original record. I know that I will need to loop it, use the split function and convert, but I am just not sure where to start.

 

Thank you in advance for any direction you can provide.

 

JP

 

Jia HuJia Hu
Try split Method of String,... like

String CF = '0.1:0.2:0.3';
List<String> CFList = CF.split(':');
System.debug(CFList);

Doc:
Search split on the page:
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_string.htm