-1

I want to write the code for extracting paragraph after each heading.

For example, consider the following input document:

Black-Box Testing

The technique of testing without having any knowledge of the interior workings of the application is called black-box testing.

White-Box Testing

White-box testing is the detailed investigation of internal logic and structure of the code.

Grey-Box Testing

Grey-box testing is a technique to test the application with having a limited knowledge of the internal workings of an application.

As output, I want three separate paragraphs with their corresponding heading= association:

output 1    Black-Box Testing

The technique of testing without having any knowledge of the interior workings of the application is called black-box testing. 

output 2  White-Box Testing

White-box testing is the detailed investigation of internal logic and structure of the code. 

output 3  Grey-Box Testing

Grey-box testing is a technique to test the application with having a limited knowledge of the internal workings of an application. 

Please guide.

Community
  • 1
  • 1

1 Answers1

0

You can split the document with '\n':
The output should be an array with 6 elements

String[] parts = document.split("\\n");
String part1 = parts[0]; // Black-Box Testing
String part2 = parts[1]; // The technique of testin...
String part3 = parts[2]; // White-Box Testing
String part4 = parts[3]; // White-box testing is the...
...
...
Mauro Midolo
  • 1,841
  • 3
  • 14
  • 34