I have to capture first paragraph characters and need to store in string.If the paragraph contains more than 300 characters we have to capture 300 only.
I wrote some code to do the same but it captures if the paragraph contains 300 or else it tries to captures from second paragraph. I have to capture first paragraph only.
String description = "Getting value from some paragraph as description";
if(StringUtils.isNotEmpty(description) && description != null && description.length()>=300){
int maxValue = 300;
description = description .substring(0, maxValue);
schema.add(description );
} else {
if(StringUtils.isNotEmpty(description) && description != null && description.length()>=0){
schema.add(description);
}
Can any one suggest me how to capture the first paragraph with 300 characters.