p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

proasp_howto thread: Testing for line-breaks


Message #1 by "Carvel Avis" <carvel@m...> on Mon, 19 Aug 2002 20:21:15
Instead of looping through the text, you can use the Split() function.  
Try this:

Dim TestBlock

TestBlock = Split(request.form("TabBlock"), vbCrLf & vbCrLf)

This function returns an array containing all of the substrings.


> I've created an html form page that submits to an asp page with the 
p> urpose of parsing the characters entered in the form and generating a 
t> ext file to be opened by another application. 

> I want to be able to separate blocks of characters everywhere there is a 
d> ouble-space (basically by paragragh) so as to separately send each 
block 
t> hrough a function I've written that does the parsing. Just to test 
this, 
I> 'm trying to use the following code and write the number of double 
c> arriage returns to a variable:

> <%
D> im TestBlock

> TestBlock = request.form("TabBlock")
T> estBlock = Trim(TabBlock)
T> estBlock = Replace(TabBlock, vbCrLf & vbCrLf, "<p>")
N> ewParaCounter = 0

> Do While InStr(TestBlock, "<P>") <> ""
	> NewParaCounter = NewParaCounter + 1
	> TestBlock = right(TestBLock, "<P>")
l> oop

> response.write NewLineCounter
%> >

> Here's the error I'm getting:

> *******************************************
M> icrosoft VBScript runtime error '800a000d'
T> ype mismatch: '[string: "<P>"]'
/> LineSeparator.asp, line 12
*> ******************************************

> The thinking was that I could use that number to define an array such as 
p> aragraph(NewLineCounter + 1).

> Problem is, every way I try to go about this, i.e., chr(10), chr(13), 
etc. 
g> ives me the same error! What can I use to simply find and separate 
blocks 
o> f text characters based on where the person entering the form data has 
u> sed their <enter> key twice?! REALLY STUCK HERE

  Return to Index