Search code examples
vbscriptasp-classic

how to separate a text as a list in classic asp


i have a question, i need to figure out how to split a text inputted in a text area but at the moment of typing is only visually ordered, i'll explain it in detail.

a determined user types in a text area something like this

this is how the input looks like

1- sample text 1.
2- sample text 2.
3- sample text 3.

that is how the user would type it in the textbox, but when i display it looks like this (note that not all users end their writing with a dot)

1- sample text 1. 2- sample text 2. 3- sample text 3.

how can i separate them visually and display it as a list? i tried replace, mid, and other functions but did not work, thanks in advance


Solution

  • If you simply want to display it like it was typed without too much extra hassle, you can use replace() in one single line of code:

    replace(inputFieldString, vbCrlf, '<br>')
    

    Some of our older systems use this method for content from textarea inputs. Quick and easy.