You need to sign in to do that
Don't have an account?
Illegal assignment from LIST<string> to String
Any suggestions, what I can do to overcome this error? thanks.
for(BulkLoadDataHolder bldhrec : dataHolderList){
Student_Tracking__c strec = new Supplier_Tracking__c();
strec.Program__c = this.blRec.Program__c;
strec.Email_Address__c = bldhrec.Email_Address;
string s = bldhrec.Email_Address.split('@',2); // Illegal assignment from LIST<string> to String
strec.D_Name = s;
system.debug('DomainName is' +strec.Domain_Name__c );
......
}
The string split() method returns an array of strings, not a single string.
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_string.htm
All Answers
The string split() method returns an array of strings, not a single string.
http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_string.htm
Assuming you are on Winter 13, you can use one of the new nifty string methods e.g.
Thanks everyone for all the replies.
I realized split() returns an array and strings and accordingly rectified my code.
we are not yet on Winter 13 so can't use substringBefore.