Click here to Skip to main content
15,891,248 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
I want to make a program to convert plain text to a specific format in html, but i can't make it so it recognizes where the paragraf is and then turn it into a '<br \>'.

Any ideas?

Thanks

What I have tried:

I've tried adding a <br \> after every dot (.), but then the text would be to short, and tried to recognized the " ", but it just didn't work.
Posted
Updated 24-May-18 2:56am
v2

1 solution

If you are just looking to replace new line characters with your break, try this:
C#
private string Convert(string input)
{
  return input.Replace(Environment.NewLine, "<br/>");
}
 
Share this answer
 
Comments
PsychoFader 24-May-18 10:05am    
Does it convert the new lines automatically or does it need to be called?

like: 'Convert();'?
Pete O'Hanlon 24-May-18 12:18pm    
You'll have to call it.
PsychoFader 24-May-18 13:11pm    
Can you give me an exemple please?
like calling it from a button?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900