Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TRIM empty line in TEXTAREA

Status
Not open for further replies.

cumap

IS-IT--Management
Jul 9, 2007
268
US
Hello all,
I'm back to the previous problem and face the problem face on now.

Ok... on the last thread, I'd be able to get away by assigning the output in the txt file to a variable then display them in the TEXTAREA after all. That works for me!

Now, my new problem is that how can I remove/trim any extra empty line in the .txt file? If I careful and make sure that I don't hit ENTER at the last line, it'll be ok; however, that can not apply to other users at all.

Thanks!
 
Use the Replace function to replace unwanted CRLF with space character?

___________________________________________________________
If you want the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
Steam Engine Prints
 
Or, something like this:

Code:
Dim sInput, arrInput, sCleanedInput
sInput = [i]value from TEXTAREA[/i]
arrInput = Split(sInput, vbCrLf)
For i = LBound(arrInput) To UBound(arrInput)
   If Trim(arrInput(i)) <> "" Then
      sCleanedInput = sCleanedInput & arrInput(i)
   End If
Next
 
Thanks guys for your recommendations and I believe they would work if I didn't use vbcrlf or an ENTER as a SPLIT tool instead of semicolon or |. To elaborate a little more, I'm doing this for the purpose of updating my Category Menu utilizing txt file as database.

My txt file looks like this:
Product 1
Product 2
Product 3
...

and here is how I display them with CSS
Code:
		<UL>
<%
		dim readString3
		readString3 = ""
		Set mainCatFileObj 	= Server.CreateObject("Scripting.FileSystemObject")
		Set mainCatFile		= mainCatFileObj.openTextFile(Server.MapPath("db/main-cat.txt"))
		If NOT mainCatFile.AtEndOfStream then
			While NOT mainCatFile.AtEndOfStream
				readString3 = trim(mainCatFile.ReadLine)
				Response.Write("<LI><a href='" & readString3 & ".asp'>" & readString3 & "</a></LI>")
			Wend
			mainCatFile.Close
		Else
%>		
			<LI><a href="#">Home</a></LI>
			<LI><a href="#">Photo Albums</a></LI>
			<LI><a href="#">Video Clips</a></LI>
			<LI><a href="#">Poem Garden</a></LI>
			<LI><a href="#">Projects</a></LI>
<%
		End If
%>		
		</UL>

So you can see that I'm in trouble if trying to eliminate vbcrlf when save/update.
 
> So you can see that I'm in trouble if trying to eliminate vbcrlf when save/update

Ummm, not really. Can you elaborate?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top