asp split string with space

I have a column in my sql database with data in it like:
FirstName: Jane
LastName: Doe

when i write it out on the page, it's all one line which is ok but when i try to split it by " " it doesn't.

On the page it looks like:
FirstName: Jane LastName: Doe
Who is Participating?
Jorge PaulinoIT Pro/DeveloperCommented:
Try to split by chr(10) or chr(13)

It looks like a break
Jorge PaulinoIT Pro/DeveloperCommented:
Can you show the code where you split? FirstName and LastName are the column names right?
BTMExpertAuthor Commented:
message = Split(Server.HTMLEncode(Recordset("FullMessage")), " ")

Open in new window

In the db it's displayed as FirstName: JaneLastName: Doe but on the site it's FirstName: Jane LastName: Doe so maybe that's the problem
käµfm³d 👽Commented:
Whitespace is typically consolidated into a single space on web pages. A quick way to display the text on multiple lines is to use a line break tag ( <br /> ). The more extensible way would be to use styles on your text. Here are examples of both:

With BR Tag
FirstName: Jane <br /> LastName: Doe

Open in new window

With Styles
<span style="display: block">FirstName: Jane</span><span style="display: block">LastName: Doe</span>

Open in new window

Note: I used an inline style here, which is generally regarded as non-extensible. Even more preferable would be to use a stylesheet and keep the style information in the separate CSS file. For instance:


    <link rel="stylesheet" href="stylesheetname.css" />


<span class="singleline">FirstName: Jane</span><span class="singleline">LastName: Doe</span>

Open in new window

    display: block;

Open in new window

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.