提取标题后跟文本

时间:2016-02-22 08:43:38

标签: java doc paragraph heading

我想编写每个标题​​后提取段落的代码。

例如,请考虑以下输入文档:

  

黑盒测试

     

在不了解应用程序内部工作原理的情况下进行测试的技术称为黑盒测试。

     

白盒测试

     

白盒测试是对内部逻辑和代码结构的详细调查。

     

灰箱测试

     

灰盒测试是一种测试应用程序的技术,它对应用程序的内部工作方式知之甚少。

作为输出,我想要三个单独的段落及其对应的标题= 关联:

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. 

请指导。

1 个答案:

答案 0 :(得分:0)

您可以使用' \ n':
分割文档 输出应该是一个包含6个元素的数组

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...
...
...
相关问题