|
-
Nov 24th, 1999, 10:54 PM
#1
What's the easiest way to go through the contents of a multiline text box and append "<br>" (without the quotes) to the end of each line?
It's part of a cgi program that lets the user open a text file and send it to the browser as a web page.
-
Nov 28th, 1999, 05:56 AM
#2
Addicted Member
Use the Instr function to loop through every character looking for the vbCrlf character. When found, append a <br> tag and carry on looking.
-
Nov 28th, 1999, 09:46 PM
#3
Yeah, I get the idea:
Code:
Dim iPosition As String
iPosition = 0
While iPosition <= Len(txtReply)
iPosition = InStr(iPosition, txtReply, vbCrLf)
If iPosition <> 0 Then
txtReply = Left(txtReply, iPosition) & "<br>" & Right(txtReply, Len(txtReply) - iPosition)
End If
Wend
but I get an "Invalid Procedure Call or Argument" on the InStr (4th) line. Help.
------------------
Matthew Ralston
E-Mail: [email protected]
ICQ:31422892
Web Sites:The Blue Link My Home Page
-
Nov 28th, 1999, 09:51 PM
#4
Addicted Member
Dim NextChar As String * 1
Dim strNew As String
For i% = 1 To Len(Text1.Text)
NextChar$ = Mid(Text1.Text, i, 1)
If NextChar$ = Chr(13) Then
strNew = strNew & "<br>" & LineText$
LineText$ = ""
ElseIf NextChar$ = Chr(10) Then
Else
LineText$ = LineText$ & NextChar$
End If
Next
------------------
"To the glory of God!"
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|