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
Linda 98Linda 98 

Capture data till line break in apex

Hi i have a use case that i need to capture data till line break and save it in varibale.
Any help on this please!!!!!!!

For example: My data is like this:

test name
Street
city,state zip,
Country


I need to get test name in to a variable and use it.Line break is only common in my data so no other way...:(

Vinay JVinay J
Dear friend,

please try

String [] streetA = street.split('[\n\r]');

for(Integer i = 0; i < streetA.size(); i++)
       system.debug(streetA[i]);