Hello
I have a text-editor (CKEditor one) whereby am retrieving all the texts (which are in 3 paragraphs), in a single string variable, using Java codes.

However, all the 3 paragraphs being retrieved have leading spaces, and I want to remove them for display purposes. How can I do so, using this single variable to hold all the texts, and keeping them formatted on 3 different lines?

Example is (from the CKEditor source)
<p>This is line 1</p>
<p>This is line 2</p>
<p>This is line 3</p>

find all occurrences of </p><p> and replace it by <br/>,
then, check if there are occurences of either <p> or <br/> with a space as next char:

while(spaceNextChar()) removeChar();

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.